CN115811545A - Service offline method, system, equipment and storage medium - Google Patents

Service offline method, system, equipment and storage medium Download PDF

Info

Publication number
CN115811545A
CN115811545A CN202111069707.4A CN202111069707A CN115811545A CN 115811545 A CN115811545 A CN 115811545A CN 202111069707 A CN202111069707 A CN 202111069707A CN 115811545 A CN115811545 A CN 115811545A
Authority
CN
China
Prior art keywords
service
node
offline
target
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111069707.4A
Other languages
Chinese (zh)
Inventor
叶超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Ezviz Software Co Ltd
Original Assignee
Hangzhou Ezviz Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Ezviz Software Co Ltd filed Critical Hangzhou Ezviz Software Co Ltd
Priority to CN202111069707.4A priority Critical patent/CN115811545A/en
Publication of CN115811545A publication Critical patent/CN115811545A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the application discloses a service offline method, a service offline system, a service offline device and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: and sending a state updating request to a service registration node, wherein the state updating request is used for requesting the service registration node to update the state of the target business service to be offline to an offline state. And waiting for a first time length to enable the gateway node to acquire the state of the target business service from the service registration node as an offline state. And sending a service offline message to a service node with the target business service deployed under the condition that the first time period waits for ending. According to the method and the device, before the target offline business service, the state of the target business service is set to be the offline state, the gateway node is enabled to obtain the offline state of the target business service, and then the target business service is offline, so that the influence of the target offline business service on the business request is avoided.

Description

Service offline method, system, equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a service offline method, a service offline system, a service offline device and a storage medium.
Background
In a C/S (client/server) structure, a server is generally deployed with one or more service nodes and a gateway node, and each service node is deployed with one or more service services. When the gateway node receives the service request from the client, the gateway node forwards the service request to the corresponding service to complete the processing of the service request. However, in some cases, the business service may need to be updated, and the business service needs to be offline first.
In the related art, a gateway node acquires the state of each service at regular time intervals, thereby selecting an online service and forwarding a service request to the online service. However, after a certain service is offline, the gateway node can acquire that the state of the service is offline after a certain time interval. During this time interval, the gateway node may still forward the service request to the service, thereby causing a failure in processing the service request. In order to solve this problem, the time interval is usually set to a minimum value, so that after the service is offline, the gateway node can acquire that the state of the service is offline in the shortest time, but since the minimum value is still greater than zero, the service request can still be affected in a short time after the service is offline.
Disclosure of Invention
The embodiment of the application provides a service offline method, a service offline system, a service offline device and a storage medium, which can solve the problem that business requests are influenced after offline service in the related art. The technical scheme is as follows:
in one aspect, a service offline method is provided, where the method includes:
sending a state updating request to a service registration node, wherein the state updating request is used for requesting the service registration node to update the state of a target business service to be offline;
waiting for a first time length to enable the gateway node to acquire the state of the target business service from the service registration node as an off-line state;
and under the condition that the first time period waiting is finished, sending a service offline message to a service node with the target business service, wherein the service offline message is used for indicating the service node to offline the target business service.
Optionally, the second duration is a time interval of refreshing a first service list by the service registration node, the third duration is a time interval of refreshing a second service list by the gateway node, the first service list is used to record a state of the target service, and the second service list is used to record a service allowed to process a service request.
Optionally, the service registration node includes a first-level cache and a second-level cache, where the first-level cache is configured to store the first service list, the second-level cache is configured to store an offline state of the target service obtained in response to the state update request, and the second duration is less than a time interval at which the first-level cache refreshes the first service list by default.
Optionally, the second service list includes a service state list and a load balancing list, the service state list is used to record states of the service services acquired from the service registration node, the load balancing list is used to record service services in an online state in the service state list, and the third duration is a sum of a refresh time interval of the service state list and a refresh time interval of the load balancing list.
Optionally, after sending the service offline message to the service node deployed with the target service, the method further includes:
sending a service deletion request to the service registration node, wherein the service deletion request is used for requesting the service registration node to delete the relevant data of the target service;
and after the service registration node deletes the relevant data of the target business service, sending a service publishing message to the service node, wherein the service publishing message is used for indicating the service node to redeploy the target business service.
Optionally, the target service is a micro service, and the service registration node is a node deployed with an Eureka service.
In another aspect, a service logoff apparatus is provided, the apparatus comprising:
a first sending module, configured to send a status update request to a service registration node, where the status update request is used to request the service registration node to update a status of a target service to be offline to an offline status;
a waiting module, configured to wait for a first time period to enable a gateway node to obtain that the state of the target service from the service registration node is an offline state;
and a second sending module, configured to send a service offline message to a service node deployed with the target service, where the service offline message is used to indicate that the service node is offline with the target service, when the first time waiting is finished.
Optionally, the first duration is greater than or equal to a sum of a second duration and a third duration, the second duration is a time interval during which the service registration node refreshes the first service list, the third duration is a time interval during which the gateway node refreshes the second service list, the first service list is used to record a state of the target service, and the second service list is used to record a service that is allowed to process the service request.
Optionally, the service registration node includes a first-level cache and a second-level cache, where the first-level cache is configured to store the first service list, the second-level cache is configured to store an offline state of the target service obtained by responding to the state update request, and the second duration is smaller than a time interval at which the first-level cache refreshes the first service list by default.
Optionally, the second service list includes a service state list and a load balancing list, the service state list is used to record states of the service services acquired from the service registration node, the load balancing list is used to record service services in an online state in the service state list, and the third duration is a sum of a refresh time interval of the service state list and a refresh time interval of the load balancing list.
Optionally, the apparatus further comprises:
a third sending module, configured to send a service deletion request to the service registration node, where the service deletion request is used to request the service registration node to delete data related to the target service;
a fourth sending module, configured to send a service publishing message to the service node after the service registration node deletes the relevant data of the target service, where the service publishing message is used to instruct the service node to redeploy the target service.
Optionally, the target service is a micro service, and the service registration node is a node deployed with an Eureka service.
In another aspect, a service logoff system is provided, the system comprising: the system comprises a service publishing node, a service registering node, a gateway node and at least one service node;
the service publishing node is used for sending a state updating request to the service registering node;
the service registration node is used for receiving the state updating request and updating the state of the target service to be offline into an offline state;
the service publishing node is also used for waiting for a first time;
in the process that the service publishing node waits for the first duration, the gateway node is used for acquiring that the state of the target business service from the service registration node is an offline state;
under the condition that the first time waiting is finished, the service publishing node is further configured to send a service offline message to a service node, in the at least one service node, where the target service is deployed;
and the service node deployed with the target business service is used for receiving the service offline message and offline the target business service.
Optionally, the service publishing node is further configured to send a service deletion request to the service registering node;
the service registration node is further configured to receive the service deletion request, and delete the relevant data of the target service;
after the service registration node deletes the relevant data of the target service, the service publishing node is further configured to send a service publishing message to the service node where the target service is deployed;
the service node deployed with the target service is also used for receiving the service release message and relocating the target service.
In another aspect, a computer device is provided, which includes a memory for storing a computer program and a processor for executing the computer program stored in the memory to implement the steps of the service logoff method.
In another aspect, a computer-readable storage medium is provided, in which a computer program is stored, which, when being executed by a processor, implements the steps of the service logoff method described above.
In another aspect, a computer program product is provided comprising instructions which, when executed on a computer, cause the computer to perform the steps of the service logoff method described above.
The technical scheme provided by the embodiment of the application can at least bring the following beneficial effects:
when the target service is offline, the service publishing node will first request the service registration node to update the state of the target service to the offline state, and then wait for a first time period, so that the gateway node obtains that the state of the target service is the offline state. Therefore, when the target business service is offline, the gateway node already knows the offline state of the target business service, and at the moment, the gateway node stops forwarding the business request to the target business service, so that the business request is not influenced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic illustration of an implementation environment provided by an embodiment of the present application;
fig. 2 is a flowchart of a service offline method according to an embodiment of the present application;
FIG. 3 is a flowchart of another service offline method provided in an embodiment of the present application;
fig. 4 is a schematic structural diagram of a service downloading device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present application more clear, the embodiments of the present application will be further described in detail with reference to the accompanying drawings.
Before explaining the service offline method provided by the embodiment of the present application in detail, the implementation environment provided by the embodiment of the present application is introduced.
Referring to FIG. 1, FIG. 1 is a schematic diagram illustrating an implementation environment in accordance with an example embodiment. The implementation environment comprises a service publishing node 101, a service registration node 102, a gateway node 103 and at least one service node 104 (the at least one service node is schematically represented in fig. 1 by one service node). The service publishing node 101 is communicatively connected to the service registration node 102 and the at least one service node 104, the service registration node 102 is communicatively connected to the gateway node 103 and the at least one service node 104, and the gateway node 103 is communicatively connected to the at least one service node 104. The communication connection may be a wired connection or a wireless connection, which is not limited in this embodiment of the present application.
The service issuing node 101 is configured to issue a new version of the service when receiving the service issuing instruction. The service issuing instruction may be triggered by an issuer clicking a button on a service issuing node, or triggered by executing a command on the service issuing node, or may be triggered by other manners, which is not limited in this embodiment of the present application.
The service registration node 102 is configured to receive a registration request of each service, complete registration of each service, and periodically refresh a state of each service. The gateway node 103 is configured to periodically obtain the status of each service from the service registration node 102, and forward a corresponding service request to the service in the online status. Service node 104 is used to deploy one or more business services.
Next, taking the target business service as an example, the process of the target business service will be described below, in which the service distribution node 101, the service registration node 102, the gateway node 103, and the at least one service node 104 cooperate with each other.
The service publishing node 101 sends a status update request to the service registration node 102. After receiving the status update request, the service registration node 102 updates the status of the target service to the offline status. After the service publishing node 101 sends the status updating request, a first time duration is waited, and within the first time duration, the gateway node 103 can acquire that the status of the target business service from the service registering node 102 is an offline status. Then, the service publishing node 101 sends a service offline message to the service node 104, and the service node 104 receives the service offline message and then performs offline target service.
Each of the service Delivery node 101, the service registration node 102, the gateway node 103, and the service node 104 may be an independent server, may also be a server cluster or a distributed system composed of a plurality of physical servers, may also be a cloud server that provides basic cloud computing services such as cloud service, a cloud database, cloud computing, cloud functions, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (Content Delivery Network), and a big data and artificial intelligence platform, or may be a cloud computing service center.
Certainly, each node of the service publishing node 101, the service registering node 102, the gateway node 103, and the service node 104 may also be a module, and the four modules may be deployed on the same server or on different servers, which is not limited in this embodiment of the present invention.
It should be noted that the system architecture and the service scenario described in the embodiment of the present application are for more clearly illustrating the technical solution of the embodiment of the present application, and do not constitute a limitation to the technical solution provided in the embodiment of the present application, and as a person having ordinary skill in the art knows that along with the evolution of the system architecture and the appearance of a new service scenario, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
The service downloading method provided by the embodiments of the present application will be explained in detail below.
Fig. 2 is a flowchart of a service offline method according to an embodiment of the present application, where the method is applied to the service publishing node 101 shown in fig. 1. Referring to fig. 2, the method includes the following steps.
S201, the service publishing node sends a state updating request to the service registration node, and the state updating request is used for requesting the service registration node to update the state of the target business service to be offline.
In some embodiments, the service publishing node may generate a status update request, where the status update request carries an identifier and a status of the target service, and the status of the target service carried by the status update request is an offline status. The service publishing node then sends the status update request to the service registration node. In this way, after the service registration node receives the status update request, the status of the target service can be updated to the offline status based on the identifier of the target service.
The identifier of the target service may be a host name and a port number of a service node where the target service is located. Of course, the identification of the target business service may also be other information for uniquely identifying the target business service. For example, a number is assigned to each service in advance, or a service name is assigned to each service, as long as the numbers or service names corresponding to different services are different.
It should be noted that, when a plurality of service services are deployed in one service node, different service services correspond to different port numbers, so that one service can be uniquely identified by a host name and a port number. In addition, the service publishing node may store the identity of each business service in advance. When the target business service needs to be offline, the service publishing node can obtain the identifier of the target business service. Of course, the identifier of each service may also be stored in a maintenance node, and the maintenance node is configured to periodically maintain each service. Thus, when the target business service needs to be offline, the service publishing node can obtain the identifier of the target business service from the maintenance node.
For example, assuming that the identifier of the target service is a host name and a port number, and the host name corresponding to the target service is a.b.c.d and the port number is xxxx, the status update request generated according to the host name and the port number is as follows:
HTTP PUT/eureka/apps/COLA-WEB-DEMO/hostname:a.b.c.d:xxxx/statusval ue=DOWN。
wherein, value = DOWN represents that the state of the target service is requested to be updated to the DOWN state.
S202, the service publishing node waits for a first time to enable the gateway node to obtain the state of the target service from the service registration node as an offline state.
Based on the above description, the gateway node periodically obtains the status of each service from the service registration node, so that after the service publishing node requests the service registration node to update the status of the target service to the offline status, the service publishing node may wait for a first time period, thereby ensuring that the gateway node can obtain the status of the target service from the service registration node as the offline status.
The first duration is greater than or equal to the sum of a second duration and a third duration, the second duration is a time interval for refreshing a first service list by the service registration node, the third duration is a time interval for refreshing a second service list by the gateway node, the first service list is used for recording the state of a target service, and the second service list is used for recording a service which allows a service request to be processed.
That is, the service registration node refreshes the first service list once every second duration, and the gateway node refreshes the second service list once every third duration, so that the maximum duration that the gateway node obtains the target service from the service registration node as the offline state is the sum of the second duration and the third duration. And when the first time length is greater than or equal to the sum of the second time length and the third time length, waiting for the first time length to ensure that the state that the gateway node acquires the target business service from the service registration node is the offline state.
In some embodiments, the service registration node includes a first-level cache and a second-level cache, the first-level cache is configured to store a first service list, the second-level cache is configured to store a down status of the target service obtained in response to the status update request, and the second duration is less than a time interval at which the first-level cache refreshes the first service list by default.
That is, in the case that the service registration node includes the first-level cache and the second-level cache, after receiving the status update request, the service registration node stores the identifier corresponding to the target service and the offline status in the second-level cache. And after the refresh time interval of the first-level cache is reached, the service registration node acquires the identifier corresponding to the target service and the offline state from the second-level cache, and updates the state of the target service in the first service list stored in the first-level cache to the offline state.
The time interval for refreshing the first service list by default in the first-level cache is the default configuration of the service registration node, and the value of the time interval is usually larger, so that the time interval for refreshing the first-level cache by default is reduced to obtain the second time length, thereby being capable of updating the state of the target service in the first service list to be the offline state in a shorter time and reducing the waiting time of the service release node.
In some embodiments, the second service list includes a service status list and a load balancing list, the service status list is used to record the status of each service acquired from the service registration node, the load balancing list is used to record the service in an online state in the service status list, and the third duration is the sum of the refresh time interval of the service status list and the refresh time interval of the load balancing list.
That is, in the case that the second service list includes the service state list and the load balancing list, after the gateway node reaches the refresh time interval of the service state list, the gateway node acquires that the state of the target service is the offline state from the service registration node, and refreshes the service state list, and then, after the refresh time interval of the load balancing list is reached, acquires that the state of the target service is the offline state from the service state list, and deletes the target service from the load balancing list.
The refresh time interval of the load balancing list is greater than or equal to the refresh time interval of the service state list, so that each service state in the service state list is the latest state when the refresh time interval of the load balancing list is reached.
It should be noted that the refresh time interval of the first-level cache, the refresh time interval of the service status list, and the refresh time interval of the load balancing list may all be modified through relevant configurations. For example, the above-mentioned refresh time interval may be modified to a minimum value, so that the first duration may be reduced.
For example, in a case that the service node deploys the service based on the SpringCloud framework, for a certain version of the SpringCloud framework, the relevant configurations of the refresh time interval of the level one cache, the refresh time interval of the service status list, and the refresh time interval of the load balancing list are as follows:
eureka.server.response-cache-update-intervals-ms=1000
eureka.client.registry-fetcch-interval-seconds=1
spring.cloud.loadbalancer.cache.ttl=2s
wherein, eureka, server, response-cache, update-intervals-ms =1000 indicates that the refresh time interval of the primary cache is 1 second, eureka, client, registration-fet-interval-seconds =1 indicates that the refresh time interval of the service state list is 1 second, and spring, client, load balance, cache, ttl =2s indicates that the refresh time interval of the load balance list is 2 seconds.
S203, under the condition that the first time period waiting is finished, the service publishing node sends a service offline message to the service node with the target service, wherein the service offline message is used for indicating the service node to offline the target service.
And under the condition that the first time waiting is finished, the gateway node already acquires that the state of the target business service from the service registration node is the offline state, the gateway node also stops sending the business request to the target business service, and at the moment, a service offline message is sent to the service node with the target business service, so as to indicate the service node to offline the target business service. In this case, the offline target business service does not affect the business request.
Under the condition that one service node deploys a plurality of service services, the service offline message carries the identification of the target service, so that the service node receives the service offline message and then performs offline of the target service according to the identification of the target service.
Because each business service includes one or more operation instances, each operation instance corresponds to one operation process, and each operation process corresponds to one process number, that is, each business service corresponds to the process number of one or more operation processes, the service node can determine the process number of one or more operation processes corresponding to the target business service according to the identifier of the target business service and the corresponding relationship between the identifier stored in advance and the process number, and then close the operation process corresponding to the one or more process numbers, that is, the offline target business service is realized.
In the case that a service node deploys a service, the service offline message does not need to carry the identifier of the target service, so that after receiving the service offline message, the service node can directly close the running process on the service node to realize the offline of the target service.
Illustratively, the command kill pid or kill-9pid may be used to close the process corresponding to the one or more process numbers, pid being the process number.
Optionally, after sending the service logout message to the service node deployed with the target business service, the method further includes: and sending a service deletion request to the service registration node, wherein the service deletion request is used for requesting the service registration node to delete the relevant data of the target service. And after the service registration node deletes the relevant data of the target business service, sending a service publishing message to the service node, wherein the service publishing message is used for instructing the service node to redeploy the target business service.
Since the service registration node still retains the relevant data of the target service after updating the state of the target service to the offline state, and it is found in the actual test process that the relevant data of the target service may cause the state of the target service to be abnormal after redeployment, a service deletion request needs to be sent to the service registration node to request the service registration node to delete the relevant data of the target service. And then, sending a service release message to the service node, wherein the service release message carries an identifier corresponding to the target service, and the service node redeployes the target service after receiving the service release message.
It should be noted that the target business service may be a micro service or a monolithic service. In the case that the target business service is a micro service, the service registration node is a node deployed with an Eureka service.
Wherein, the service node deploys the micro-service based on the spring cloud framework, and the Eureka service provided by the spring cloud framework can be used for registration and state management of the micro-service, in this case, the service registration node is a node deployed with the Eureka service.
Illustratively, in the case where the service node deploys the micro-service based on the SpringCloud framework, the service registration node may be a Eureka Server, and the gateway node may be a SpringCloud gateway. As shown in fig. 3, a micro service is taken as an example to exemplarily explain a service offline method provided in the embodiment of the present application, and the method includes steps S301 to S308.
S301, the service issuing node receives an issuing instruction of the target micro service to be offline. Wherein the issuing instruction is triggered by the issuing personnel.
S302, the service publishing node acquires the host name and the port number of the target micro service and generates a state updating request, wherein the state updating request carries the host name and the port number of the target micro service. And then calls an interface of the Eureka Server and sends the status update request to the Eureka Server.
S303, the Eureka Server receives the state updating request and updates the state of the target micro service to be offline to be the offline state.
And under the condition that the Eureka Server comprises a first-level cache and a second-level cache, after receiving the state updating request, the Eureka Server stores the state of the target micro service in the second-level cache as a down line state. After the refresh time interval of the first-level cache is reached, the Eureka Server acquires the offline state of the target micro service from the second-level cache, and updates the state of the target micro service stored in the first-level cache to the offline state.
S304, the service publishing node waits for the first time to wait for the state of the target micro service in the micro service list of the SpringCloud gateway to be refreshed into the offline state.
S305, in the process that the service publishing node waits for the first time, the SpringCloud gateway obtains the state of the target micro service from the Eureka Server as the off-line state after the service obtaining time interval is reached, refreshes the state of the target micro service in the micro service list as the off-line state, and stops forwarding the service request to the target micro service.
The first duration is the sum of a cache refresh time interval and a service acquisition time interval. The default cache refresh time interval of the Eureka Server is 90 seconds, and the cache refresh time interval and the service acquisition time interval can be modified to reduce the first time length, so that the issuing speed of the target micro service is accelerated.
S306, the service publishing node sends a service offline message to the service node to indicate the service node offline target micro-service. Where the kill-9 command may be used to force the downline target microservice.
S307, the service publishing node sends an HTTP DELETE request to the Eureka Server to request the Eureka Server to DELETE the relevant data of the target micro-service from the Eureka Server. The purpose of this step is to prevent the Eureka Server from being unable to delete the relevant data of the target micro-service after the Eureka Server has an abnormal condition or enters into a protection mode, so as to cause the target micro-service to have an abnormal state after redeployment.
S308, the service publishing node sends a service publishing message to the service node to indicate the service node to redeploy the target micro service.
It should be noted that, after the service node redeploys the target service, the service node may send a service registration request to the service registration node, and after receiving the service registration request, the service registration node completes registration of the target service, and then records the target service in the first service list, and sets the state of the target service in the first service list as an online state. And after the third duration is reached, the gateway node acquires that the state of the target service is the online state from the service registration node, records the online state of the target service in a second service list, and then forwards a corresponding service request to the target service.
Based on the above description, in some embodiments, the second service list includes a service status list and a load balancing list. In this case, after the gateway node reaches the refresh time interval of the service state list, the gateway node acquires that the state of the target service is online from the service registration node and records the state in the service state list, then acquires that the state of the target service is online from the service state list and records the state in the load balancing list after the refresh time interval of the load balancing list is reached, and then the gateway node forwards a corresponding service request to the target service.
In the embodiment of the application, the state updating request is sent to the service registration node, the service registration node is requested to update the state of the target business service to be offline to the offline state, and then the first time is waited to ensure that the state that the gateway node acquires the target business service from the service registration node is the offline state, so that the gateway node stops forwarding the business request to the target business service, and at the moment, the service node is requested to perform the offline target business service, and the business request is not influenced.
Fig. 4 is a schematic structural diagram of a service downline apparatus provided in an embodiment of the present application, where the service downline apparatus may be implemented as part or all of a service publishing node by software, hardware, or a combination of the two, and the service publishing node may be the service publishing node 101 shown in fig. 1. Referring to fig. 3, the apparatus includes: a first sending module 401, a waiting module 402 and a second sending module 403.
A first sending module 401, configured to send a status update request to a service registration node, where the status update request is used to request the service registration node to update a status of a target service to be offline to an offline status;
a waiting module 402, configured to wait for a first time period to enable the gateway node to obtain the state of the target service from the service registration node as an offline state;
a second sending module 403, configured to send a service offline message to the service node deployed with the target service, where the service offline message is used to indicate that the service node offline the target service, when the first time waiting ends.
Optionally, the first duration is greater than or equal to a sum of a second duration and a third duration, the second duration is a time interval during which the service registration node refreshes the first service list, the third duration is a time interval during which the gateway node refreshes the second service list, the first service list is used to record a state of the target service, and the second service list is used to record a service that is allowed to process the service request.
Optionally, the service registration node includes a first-level cache and a second-level cache, where the first-level cache is configured to store a first service list, the second-level cache is configured to store an offline state of the target service obtained by responding to the state update request, and the second duration is smaller than a time interval at which the first-level cache refreshes the first service list by default.
Optionally, the second service list includes a service state list and a load balancing list, the service state list is used to record states of the service services acquired from the service registration node, the load balancing list is used to record service services in an online state in the service state list, and the third duration is a sum of a refresh time interval of the service state list and a refresh time interval of the load balancing list.
Optionally, the apparatus further comprises:
a third sending module, configured to send a service deletion request to a service registration node, where the service deletion request is used to request the service registration node to delete related data of a target service;
and the fourth sending module is used for sending a service publishing message to the service node after the service registration node deletes the relevant data of the target service, wherein the service publishing message is used for indicating the service node to redeploy the target service.
Optionally, the target service is a micro service, and the service registration node is a node deployed with an Eureka service.
In the embodiment of the application, the state updating request is sent to the service registration node, the service registration node is requested to update the state of the target business service to be offline to the offline state, and then the first time is waited to ensure that the state of the target business service acquired by the gateway node from the service registration node is the offline state, so that the gateway node stops forwarding the business request to the target business service, and at the moment, the service node is requested to perform offline target business service, and the business request cannot be influenced.
It should be noted that: in the service offline device provided in the above embodiment, only the division of the functional modules is illustrated when the offline device is offline for service, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the service offline device and the service offline method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
Fig. 5 is a schematic structural diagram of a server according to an embodiment of the present application. The server may be the service publishing node described above. The server 500 includes a Central Processing Unit (CPU) 501, a system memory 504 including a Random Access Memory (RAM) 502 and a Read Only Memory (ROM) 503, and a system bus 505 connecting the system memory 504 and the central processing unit 501. The server 500 also includes a basic input/output system (I/O system) 506, which facilitates transfer of information between devices within the computer, and a mass storage device 507, which stores an operating system 513, application programs 514, and other program modules 515.
The basic input/output system 506 comprises a display 508 for displaying information and an input device 509, such as a mouse, keyboard, etc., for user input of information. Wherein a display 508 and an input device 509 are connected to the central processing unit 501 through an input output controller 510 connected to the system bus 505. The basic input/output system 506 may also include an input/output controller 510 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, input-output controller 510 also provides output to a display screen, a printer, or other type of output device.
The mass storage device 507 is connected to the central processing unit 501 through a mass storage controller (not shown) connected to the system bus 505. The mass storage device 507 and its associated computer-readable media provide non-volatile storage for the server 500. That is, the mass storage device 507 may include a computer readable medium (not shown) such as a hard disk or CD-ROM drive.
Without loss of generality, computer readable media may comprise computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, DVD, or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that computer storage media is not limited to the foregoing. The system memory 504 and mass storage device 507 described above may be collectively referred to as memory.
According to various embodiments of the present application, server 500 may also operate as a remote computer connected to a network through a network, such as the Internet. That is, the server 500 may be connected to the network 512 through the network interface unit 511 connected to the system bus 505, or may be connected to other types of networks or remote computer systems (not shown) using the network interface unit 511.
The memory also includes one or more programs, which are stored in the memory and configured to be executed by the CPU.
In some embodiments, there is also provided a service logoff system, the system comprising: the system comprises a service publishing node, a service registering node, a gateway node and at least one service node;
the service publishing node is used for sending a state updating request to the service registering node. The service registration node is used for receiving the state updating request and updating the state of the target business service to be offline into an offline state. The service publishing node is also configured to wait for a first duration. And in the process that the service publishing node waits for the first time, the gateway node is used for acquiring the state of the target service from the service registration node as the offline state. And under the condition that the first time period waits for ending, the service publishing node is also used for sending a service offline message to a service node which is deployed with the target business service in at least one service node. The service node deployed with the target service is used for receiving the service offline message and offline the target service.
Optionally, the service publishing node is further configured to send a service deletion request to the service registering node. The service registration node is also used for receiving a service deletion request and deleting the related data of the target service. After the service registration node deletes the relevant data of the target business service, the service publishing node is further used for sending a service publishing message to the service node with the target business service. The service node deployed with the target service is also used for receiving the service release message and redeploying the target service.
In some embodiments, a computer-readable storage medium is also provided, in which a computer program is stored, which, when executed by a processor, implements the steps of the service logoff method in the above embodiments. For example, the computer readable storage medium may be a ROM, a RAM, a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
It is noted that the computer-readable storage medium referred to in the embodiments of the present application may be a non-volatile storage medium, in other words, a non-transitory storage medium.
It should be understood that all or part of the steps for implementing the above embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented in software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The computer instructions may be stored in the computer readable storage medium described above.
That is, in some embodiments, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the steps of the service logoff method described above.
It is to be understood that reference herein to "at least one" means one or more and "a plurality" means two or more. In the description of the embodiments of the present application, "/" indicates an alternative meaning, for example, a/B may indicate a or B; "and/or" herein is merely an association describing an associated object, and means that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, in order to facilitate clear description of technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish identical items or similar items with substantially identical functions and actions. Those skilled in the art will appreciate that the terms "first," "second," etc. do not denote any order or quantity, nor do the terms "first," "second," etc. denote any order or importance.
The above-mentioned embodiments are provided not to limit the present application, and any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. A service offline method is applied to a service publishing node, and comprises the following steps:
sending a state updating request to a service registration node, wherein the state updating request is used for requesting the service registration node to update the state of a target business service to be offline to an offline state;
waiting for a first time length to enable the gateway node to acquire the state of the target business service from the service registration node as an offline state;
and under the condition that the first time period waiting is finished, sending a service offline message to a service node with the target business service, wherein the service offline message is used for indicating the service node to offline the target business service.
2. The method of claim 1, wherein the first duration is greater than or equal to a sum of a second duration and a third duration, the second duration being a time interval during which the service registration node refreshes a first service list, the third duration being a time interval during which the gateway node refreshes a second service list, the first service list being used for recording a status of the target service, the second service list being used for recording service services that are allowed to process a service request.
3. The method of claim 2, wherein the service registration node comprises a level one cache and a level two cache, the level one cache is configured to store the first service list, the level two cache is configured to store a down status of the target business service in response to the status update request, and the second duration is less than a time interval during which the level one cache defaults to refresh the first service list.
4. The method according to claim 2 or 3, wherein the second service list includes a service status list and a load balancing list, the service status list is used to record statuses of the respective service services acquired from the service registration node, the load balancing list is used to record service services in online states in the service status list, and the third duration is a sum of a refresh time interval of the service status list and a refresh time interval of the load balancing list.
5. The method of claim 1, wherein after sending the service logoff message to the service node deployed with the target business service, further comprising:
sending a service deletion request to the service registration node, wherein the service deletion request is used for requesting the service registration node to delete the relevant data of the target service;
and after the service registration node deletes the relevant data of the target business service, sending a service publishing message to the service node, wherein the service publishing message is used for indicating the service node to redeploy the target business service.
6. The method of claim 1, wherein the target business service is a microservice and the service registration node is a node deployed with a Eureka service.
7. A service logoff system, the system comprising: the system comprises a service publishing node, a service registering node, a gateway node and at least one service node;
the service publishing node is used for sending a state updating request to the service registering node;
the service registration node is used for receiving the state updating request and updating the state of the target service to be offline into an offline state;
the service publishing node is also used for waiting for a first time length;
in the process that the service publishing node waits for the first duration, the gateway node is used for acquiring that the state of the target business service from the service registration node is an offline state;
under the condition that the first time period waiting is finished, the service publishing node is further configured to send a service offline message to a service node, where the target business service is deployed, in the at least one service node;
and the service node deployed with the target business service is used for receiving the service offline message and offline the target business service.
8. The system of claim 7,
the service publishing node is also used for sending a service deleting request to the service registering node;
the service registration node is also used for receiving the service deletion request and deleting the relevant data of the target service;
after the service registration node deletes the relevant data of the target service, the service publishing node is further configured to send a service publishing message to the service node deployed with the target service;
the service node deployed with the target service is also used for receiving the service release message and redeploying the target service.
9. A computer device, characterized in that the computer device comprises a memory for storing a computer program and a processor for executing the computer program stored in the memory to implement the steps of the method according to any of the claims 1-6.
10. A computer-readable storage medium, characterized in that a computer program is stored in the storage medium, which computer program, when being executed by a processor, carries out the steps of the method according to any one of claims 1-6.
CN202111069707.4A 2021-09-13 2021-09-13 Service offline method, system, equipment and storage medium Pending CN115811545A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111069707.4A CN115811545A (en) 2021-09-13 2021-09-13 Service offline method, system, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111069707.4A CN115811545A (en) 2021-09-13 2021-09-13 Service offline method, system, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115811545A true CN115811545A (en) 2023-03-17

Family

ID=85481162

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111069707.4A Pending CN115811545A (en) 2021-09-13 2021-09-13 Service offline method, system, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115811545A (en)

Similar Documents

Publication Publication Date Title
CN107666525B (en) Method and device for IP allocation of cluster container
JP4637842B2 (en) Fast application notification in clustered computing systems
CN111400112B (en) Writing method and device of storage system of distributed cluster and readable storage medium
CN109150987B (en) Two-layer container cluster elastic expansion method based on host layer and container layer
US9367261B2 (en) Computer system, data management method and data management program
US20150236902A1 (en) System, method and apparatus to manage services in a network
US9875061B2 (en) Distributed backup system
US20210037105A1 (en) Dynamic Discovery of Available Storage Servers
US20160344582A1 (en) Call home cluster
CN113342547B (en) Remote service calling method and device, electronic equipment and readable storage medium
US11397632B2 (en) Safely recovering workloads within a finite timeframe from unhealthy cluster nodes
EP3817290A1 (en) Member change method for distributed system, and distributed system
US10817512B2 (en) Standing queries in memory
JP2016177324A (en) Information processing apparatus, information processing system, information processing method, and program
CN110286854B (en) Method, device, equipment and storage medium for group member management and group message processing
US10185735B2 (en) Distributed database system and a non-transitory computer readable medium
US20200267230A1 (en) Tracking client sessions in publish and subscribe systems using a shared repository
CN115811545A (en) Service offline method, system, equipment and storage medium
CN116346834A (en) Session synchronization method, device, computing equipment and computer storage medium
US11290318B2 (en) Disaster recovery of cloud resources
CN114546591A (en) Mirror image file sharing method, container cluster management system and related equipment
CN110502460B (en) Data processing method and node
EP4323881A1 (en) Geographically dispersed hybrid cloud cluster
CN111338647B (en) Big data cluster management method and device
CN108683533B (en) Configuration updating method, configuration updating response method, server and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination