CN116743762A - Service registration cluster flow switching method, flow switching device and storage medium - Google Patents

Service registration cluster flow switching method, flow switching device and storage medium Download PDF

Info

Publication number
CN116743762A
CN116743762A CN202310729917.4A CN202310729917A CN116743762A CN 116743762 A CN116743762 A CN 116743762A CN 202310729917 A CN202310729917 A CN 202310729917A CN 116743762 A CN116743762 A CN 116743762A
Authority
CN
China
Prior art keywords
service registration
cluster
source
registration cluster
target
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
CN202310729917.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.)
China Merchants Bank Co Ltd
Original Assignee
China Merchants Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Merchants Bank Co Ltd filed Critical China Merchants Bank Co Ltd
Priority to CN202310729917.4A priority Critical patent/CN116743762A/en
Publication of CN116743762A publication Critical patent/CN116743762A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1023Server selection for load balancing based on a hash applied to IP addresses or costs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/28Routing or path finding of packets in data switching networks using route fault recovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1061Peer-to-peer [P2P] networks using node-based peer discovery mechanisms
    • H04L67/1065Discovery involving distributed pre-established resource-based relationships among peers, e.g. based on distributed hash tables [DHT] 

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a service registration cluster flow switching method, a flow switching device and a storage medium, wherein the service registration cluster flow switching method comprises the following steps: after the source service registration cluster to be upgraded passes the ready check of the corresponding target service registration cluster, registering a target service instance for the target service registration cluster according to the service instance snapshot of the source service registration cluster; when the number of the registration services and the number of the registration instances corresponding to the target service registration cluster are the same as the data corresponding to the source service registration cluster, modifying an internal route address associated with an external route of the source service registration cluster into a service node corresponding to the target service registration cluster; and after receiving the flow request of the service registration client, routing the flow request to the target service registration cluster. The invention solves the problem of service continuity interruption caused by traffic switching based on domain name.

Description

Service registration cluster flow switching method, flow switching device and storage medium
Technical Field
The present invention relates to the field of cluster upgrade, and in particular, to a service registration cluster traffic switching method, a traffic switching device, and a storage medium.
Background
In a production environment, service registration and discovery centers are typically present in clusters. In use, to increase the service processing capacity, it is often necessary to upgrade the service registration cluster. When the service registration cluster is upgraded, traffic switching needs to be performed among the service nodes.
In the related service registration cluster traffic upgrading process, traffic is generally switched by using the domain name of the service registration cluster, so that traffic upgrading of the service registration cluster is completed. However, in the scenario of providing a service registration cluster service on a large scale, the client DNS (Domain Name System ) may not update the resolution address corresponding to the domain name due to the limitation of the underlying logic. For example, device C switches from cluster a to cluster B, which still accesses cluster a after a cluster upgrade due to the domain name cache not being cleaned. At this time, the configuration of the client needs to be modified or the client needs to be restarted to update the resolved address corresponding to the domain name again, so that continuity of the service system using the service registration cluster is interrupted.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present invention and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The invention mainly aims to provide a service registration cluster flow switching method, a flow switching device and a storage medium, which solve the problem of service continuity interruption caused by flow switching based on domain names in the prior art.
In order to achieve the above object, the present invention provides a service registration cluster traffic switching method, which includes the following steps:
after the source service registration cluster to be upgraded passes the ready check of the corresponding target service registration cluster, registering a target service instance for the target service registration cluster according to the service instance snapshot of the source service registration cluster;
when the number of the registration services and the number of the registration instances corresponding to the target service registration cluster are the same as the data corresponding to the source service registration cluster, modifying an internal route address associated with an external route of the source service registration cluster into a service node corresponding to the target service registration cluster;
and after receiving the flow request of the service registration client, routing the flow request to the target service registration cluster.
Optionally, after the source service registration cluster to be upgraded and the corresponding target service registration cluster ready check passes, before the step of registering the target service instance for the target service registration cluster according to the service instance snapshot of the source service registration cluster, the method further includes:
After the source service registration cluster is pre-checked, automatically deploying the target service registration cluster corresponding to the source service registration cluster based on a container application management platform;
and when the state of each node of the target service registration cluster is UP, DS replies of each node are complete and consistent, and an interface of each node returns normally, judging that the ready detection of the target service registration cluster passes.
Optionally, before the step of automatically deploying the target service registration cluster corresponding to the source service registration cluster based on the container application management platform after the source service registration cluster is pre-checked, the method further includes:
after receiving an upgrade instruction of the source service registration cluster, determining a domain name distribution strategy of the source service registration cluster;
if the domain name distribution strategy is balanced distribution, and a service registration client uses an IP address to register in the source service registration cluster, judging that the source service registration cluster fails to pre-check, and terminating the upgrading action of the source service registration cluster; or alternatively
After determining a domain name distribution strategy of the source service registration cluster, judging that the source service registration cluster fails to pre-check when detecting that the service registration client uses an internal route to communicate with the source service registration cluster, and terminating the upgrading action of the source service registration cluster; otherwise
And judging that the source service registration cluster pre-check passes.
Optionally, after the step of registering the target service instance for the target service registration cluster according to the service instance snapshot of the source service registration cluster after the ready check of the corresponding target service registration cluster passes, the step of registering the target service instance for the target service registration cluster further includes:
adjusting a self-protection duration percentage threshold factor of the service registration cluster, and controlling the source service registration cluster to enter a self-protection mode when detecting that the heartbeat request feedback time of the source service registration cluster is longer than a preset time, so as to improve the corresponding waiting time of the heartbeat request and avoid the service instance of the service registration client to be removed; or alternatively
And sending a heartbeat request to the target service registration cluster based on a preset time interval until the heartbeat request is not received in the source service registration cluster, so that the request of the service registration client is sent to the target service registration cluster.
Optionally, when the number of registration services and the number of registration instances corresponding to the target service registration cluster are the same as the data corresponding to the source service registration cluster, the step of modifying the internal routing address associated with the external routing of the source service registration cluster to the service node corresponding to the target service registration cluster includes:
When the number of the registration services and the number of the registration instances corresponding to the target service registration cluster are the same as the data corresponding to the source service registration cluster, determining the binding relation between the external route and the internal route of the source service registration cluster;
when the internal routing address associated with the external routing is a source service node of the source service registration cluster, modifying the internal routing address to the service node of the target service registration cluster.
Optionally, after the step of routing the traffic request to the target service registration cluster after receiving the traffic request of the service registration client, the method further includes:
after restarting the source service registration cluster, if the message number of the source service registration cluster is empty, judging that the source service registration cluster flow switching is successful;
and deleting the related container resources of the source service registration cluster.
Optionally, after the source service registration cluster to be upgraded and the corresponding target service registration cluster ready check passes, the step of registering the target service instance for the target service registration cluster according to the service instance snapshot of the source service registration cluster includes:
After the source service registration cluster to be upgraded passes the corresponding target service registration cluster ready inspection, obtaining the service instance snapshot of the source service registration cluster, and storing the service instance snapshot into a disk so that the source service registration cluster can perform data rollback operation;
and registering the target service instance for the target service registration cluster according to the service instance snapshot.
Optionally, the method further comprises:
outputting a visual operation interface of the source service registration cluster upgrade;
and executing corresponding upgrading actions according to the operation instructions of the visual operation interface, and automatically completing upgrading verification and flow switching tasks of the source service registration cluster.
In addition, in order to achieve the above object, the present invention also provides a traffic switching device, where the traffic switching device includes a memory, a processor, and a traffic switching program stored in the memory and capable of running on the processor, where the traffic switching program, when executed by the processor, implements the steps of the service registration cluster traffic switching method as described above.
In addition, to achieve the above object, the present invention further provides a computer-readable storage medium having stored thereon a traffic switching program which, when executed by a processor, implements the steps of the service registration cluster traffic switching method as described above.
The embodiment of the invention provides a service registration cluster flow switching method, a flow switching device and a storage medium, wherein after a target service registration cluster corresponding to a source service registration cluster to be upgraded passes a ready check, the same service instance is registered for the target service registration cluster based on a service instance snapshot of the source service registration cluster, and when the registration service number of the source service registration cluster is equal to the data corresponding to the target service registration cluster, an internal routing address associated with an external routing of the source service registration cluster is modified to be a service node corresponding to the target service registration cluster, so that a flow request of a service registration client can be forwarded to the target service registration cluster. In the process, the domain name of the service registration cluster is not changed, and the DNS analysis result is not changed, so that the service registration client can complete flow switching in a very short time, the problem of service continuity interruption caused by long-time non-updating of the DNS cache of the service registration client is avoided, the upgrading efficiency of the service registration cluster is improved, and the service continuity is ensured.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention. In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a flow chart of a first embodiment of a service registration cluster traffic switching method according to the present invention;
FIG. 2 is an upgrade schematic diagram of a source service registration cluster architecture of the service registration cluster traffic switching method of the present invention;
FIG. 3 is a schematic diagram of client traffic switching after cluster upgrade in the service registration cluster traffic switching method of the present invention;
FIG. 4 is a schematic diagram of a second embodiment of a service registration cluster traffic switching method according to the present invention;
FIG. 5 is a flow chart illustrating a third embodiment of a service registration cluster traffic switching method according to the present invention;
FIG. 6 is a complete flow chart of the source service registration cluster traffic upgrade switching of the service registration cluster traffic switching method of the present invention;
fig. 7 is a schematic diagram of a terminal hardware structure of various embodiments of the service registration cluster traffic switching method of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
In order to better understand the above technical solution, exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Referring to fig. 1, fig. 1 is a schematic diagram of a first embodiment of a service registration cluster traffic switching method according to the present invention.
In this embodiment, the service registration cluster traffic switching method includes the following steps:
step S10, after a source service registration cluster to be upgraded and a corresponding target service registration cluster ready check pass, registering a target service instance for the target service registration cluster according to a service instance snapshot of the source service registration cluster;
in this embodiment, the service registration cluster may be a Eureka (service registration center) cluster, the source service registration cluster to be upgraded is a source Eureka cluster, the target service registration cluster is a target Eureka cluster, it is understood that the source service registration cluster is a pre-upgrade Eureka cluster, and the target service registration cluster is an upgraded Eureka cluster.
Specifically, after the source Eureka cluster performs the upgrade action and the pre-inspection passes, the target Eureka cluster corresponding to the source Eureka cluster is automatically deployed based on Kubernetes (container application management platform). After the source Eurka cluster to be upgraded passes the ready inspection of the corresponding target Eurka cluster, the current service instance snapshot of the source Eurka cluster is obtained, and the service instance snapshot is stored in a disk so that the source service registration cluster performs data rollback operation, and then a target service instance is registered for the target Eurka cluster according to the service instance snapshot, thereby ensuring that the registration service number and the registration instance number of the source Eurka cluster are consistent with the data correspondence of the target Eurka cluster before traffic switching. Wherein, in the process, heartbeat requests can be continuously injected into the target Eureka cluster, so that the heartbeat requests of each newly registered service instance are maintained.
It should be noted that the Eureka cluster is deployed over a federal cluster consisting of three Kubernetes, each located at a different AZ (Available Zone). As shown in fig. 2, the source eurka cluster is composed of three nodes, and the nodes mutually synchronize information. The target Eureka cluster is composed of six nodes, and the nodes are mutually information-synchronized (in FIG. 2, only node A1 is taken as an example to represent the communication relationship between the nodes). While the target eurka cluster as shown in fig. 2 has high availability and better performance than the source eurka cluster. The upgrade action of the source Eurka cluster is not a mode of covering upgrade, but after the target Eurka cluster is deployed in a federal cluster composed of three Kubernetes, the spec.to.name attribute of the Route resource object is modified into Service (internal Route) resource of the target Eurka cluster, so that the traffic request of the Eurka client can be sent to the target Eurka cluster.
Step S20, when the number of the registered services and the number of the registered instances corresponding to the target service registration cluster are the same as the data corresponding to the source service registration cluster, modifying the internal routing address associated with the external routing of the source service registration cluster into the service node corresponding to the target service registration cluster;
In this embodiment, in the traffic switching process of the Eureka cluster, the registration service number and the registration instance number of the source Eureka cluster need to be guaranteed to be consistent with the data corresponding to the target Eureka cluster. And traffic switching refers to a binding relationship switching of an external route and an internal route of the Eureka cluster.
Specifically, when the number of registered services and the number of registered instances corresponding to the target service registration cluster are the same as the data corresponding to the source service registration cluster, determining a binding relationship between an external route and an internal route of the source service registration cluster, and when the internal route address associated with the external route is a source service node of the source service registration cluster, modifying the internal route address to be the service node corresponding to the target service registration cluster. The binding relationship between the external Route and the internal Route of the Eureka cluster is determined by the Route resource object and the Service resource object, that is, the Route resource object is the external Route, and the Service resource object is the internal Route of the Eureka cluster. The target access address is specified by the spec.to.name attribute in the Route resource object.
Whereas in Route resource objects, the POD set can be selected as its Endpoint object by metadata. Based on this, the Eureka client can access to the Service-associated POD instance (node of the Eureka cluster) using Route. When the number of registration services and the number of registration instances corresponding to the source Eureka cluster are the same as the data corresponding to the target Eureka cluster, the system can automatically modify the spec.to.name attribute of the Route resource object into the Service resource object name of the target Eureka cluster, so that the traffic request of the Eureka client can be forwarded to the target Eureka cluster.
Step S30, after receiving the flow request of the service registration client, the flow request is routed to the target service registration cluster.
In this embodiment, the Eureka client is able to access the Eureka cluster using a fixed domain name. The system can automatically modify the Route spec.to.name attribute to be associated to the Service resource of the target Eureka cluster.
Further, referring to fig. 3, before upgrading the source eurka cluster, the eurka client may access Service resources of the source eurka cluster based on a fixed domain name (as indicated by a dashed arrow); after the source Eurka cluster is upgraded, the request of the Eurka client is changed from the original source Eurka cluster to the target Eurka cluster (shown by a solid arrow below in FIG. 3), and then the lossless switching of the flow in the Eurka cluster upgrading process is completed.
Optionally, after the upgrade traffic of the source service registration cluster is switched, the resources of the source service registration cluster need to be recovered, so as to avoid waste of resource cost. And at the moment, after the source service registration cluster is required to be restarted, if the number of the service and the service instance of the source service registration cluster is empty, judging that the flow switching of the source service registration cluster is successful, and then deleting the related container resources of the source service registration cluster. Wherein the related container resources include Deployment, configMap, service of Kubernetes and Route resource objects.
Optionally, the service registration cluster traffic switching method further includes: outputting a visual operation interface of the source service registration cluster upgrade, executing corresponding upgrade actions according to an operation instruction of the visual operation interface, and automatically completing upgrade checking and flow switching tasks of the source service registration cluster. That is, the traffic upgrade switching of the source Eureka cluster may be implemented through a visual interface. The whole upgrading process can also be checked according to the current visual interface.
In the technical solution disclosed in this embodiment, after the target Service registration cluster ready corresponding to the Service registration cluster to be upgraded passes the inspection, the same number of target Service instances are registered for the target Service registration cluster based on the obtained Service instance snapshot of the source Service registration cluster, and after the registration is completed, the spec.to.name attribute corresponding to the external Route (Route resource object) of the source Service registration cluster is modified to the Service resource object name of the target Service registration cluster, so that the upgrade of the source Service registration cluster is completed, and the traffic request of the Service registration client can be forwarded to the target Service registration cluster. In the process, the domain name of the service registration cluster is not changed, and then the DNS analysis result is not changed (namely, the lossless switching of the traffic is finished), so that the service registration client can finish the traffic switching in a very short time, the problem of service continuity interruption caused by long-time non-updating of the DNS cache of the service registration client is avoided, the traffic switching efficiency is improved, and the service continuity is ensured.
Referring to fig. 4, in the second embodiment, based on the first embodiment, before step S10, further includes:
step S40, after the source service registration cluster is pre-checked, automatically deploying the target service registration cluster corresponding to the source service registration cluster based on a container application management platform;
in this embodiment, after the pre-inspection of the Eureka cluster passes, it is explained that the Eureka cluster meets the upgrade requirement, where Kubernetes can implement automatic deployment of the Eureka cluster.
Specifically, after the Eureka cluster is pre-checked, a FreeMarker template engine is used to generate Deployment, configMap, service of Kubernetes and YAML files of Route resources based on a preset FTL (FreeMarker Template Language, free mark template language) template and the requirements of a user, and then an API Server interface is called by clients of the Kubernetes to create resource objects required by the target Eureka cluster. In default, the name, security authentication information, container resource specification, JVM memory parameter, external route distribution policy and other information of the newly deployed eurka cluster (target eurka cluster) are consistent with the source eurka cluster. Based on the method, the automatic deployment of the target service registration cluster is realized.
Alternatively, the pre-checking may be to check the domain name distribution policy of the source service registry cluster and check the communication policy of the service registry client. That is, before step S40, the method further includes:
after receiving an upgrade instruction of the source service registration cluster, determining a domain name distribution strategy of the source service registration cluster, and if the domain name distribution strategy is balanced distribution and a service registration client uses an IP (Internet Protocol Address, internet protocol) address to register in the source service registration cluster, judging that the pre-inspection of the source service registration cluster fails and terminating the upgrade action of the source service registration cluster; or after determining the domain name distribution strategy of the source service registration cluster, judging that the source service registration cluster fails to pre-check when detecting that the service registration client uses an internal route to communicate with the source service registration cluster, and terminating the upgrading action of the source service registration cluster; otherwise, judging that the source service registration cluster pre-checking passes, namely judging that the source service registration cluster pre-checking passes when the source service registration cluster pre-checking does not exist in the two cases.
It should be noted that, the domain name distribution policy of the Eureka cluster includes three kinds of source address distribution, balanced distribution and weight distribution.
Illustratively, in the case where the domain name distribution policy of the eurka cluster is source address distribution, if the service provider uses POD IP (node internet protocol address) for registration, the POD IP of the service provider a instance can be registered to the eurka cluster node of a, the POD IP of the service provider B instance can be registered to the eurka cluster node of B, and the POD IP of the service provider C instance can be registered to the eurka cluster node of C, that is, when registration is performed based on the source address distribution policy, the POD IP can be registered to the corresponding eurka cluster node of the service provider. And when the service calling party discovers the instance information of the service provider which is the same as the AZ where the service calling party is located, the service calling party can normally call the service.
When the distributed Eureka cluster is distributed by the balanced distribution strategy, if the updated Eureka cluster is deployed in a federal cluster formed by three Kubernetes, in the federal cluster, the service A and the service B of the Eureka client end register corresponding POD IPs (balanced distribution strategy characteristics) in K1, K2 and K3, and at the moment, the service A in the high-availability zone K1 wants to call the service B, and the POD IPs of the service B in K1 need to be acquired. However, since the service B registers POD IP in both K2 and K3, when the service a in K1 obtains POD IP of the service B in K2 or K3, the service a cannot access the service B, which results in a problem of access between the services. Therefore, under the balanced distribution policy, before the Eureka cluster is upgraded, it is necessary to check whether the client uses the POD IP for registration, and if the client uses the POD IP for registration, the Eureka cluster is blocked from being upgraded.
When the service registration client uses the internal route to communicate with the source service registration cluster, the original internal route is changed after the migration and the upgrading are carried out by the scheme of the invention, so that the registration of the Eureka client in the target Eureka cluster can not be completed. Thus, when a Eureka client uses internal routing to communicate with a source Eureka, upgrades to the source Eureka cluster need to be blocked.
If the source Eureka cluster does not meet all the conditions, the pre-checking pass is indicated, namely the source Eureka cluster is judged to pass.
And step S50, judging that the target service registration cluster ready detection passes when the state of each node of the target service registration cluster is UP, DS replies of each node are complete and consistent, and an interface of each node returns normally.
In this embodiment, the FTL template deployed by the Eureka cluster is configured with a survival probe and a ready probe, and detection is performed based on the survival probe and the ready probe. Further ensuring availability of the Eureka cluster after deployment requires a secondary detection of the newly deployed Eureka cluster (i.e., the target Eureka cluster), the detection content including: judging whether the state of each node of the target Eureka cluster is UP, whether DS replies of each node are complete and consistent, and whether an application service (/ application service) interface of each node returns normally.
In the technical scheme disclosed in the embodiment, the source service registration cluster is pre-checked, the service registration cluster which does not meet the upgrading requirement is filtered, and the usability of the target service registration cluster after upgrading is prevented from being reduced. After the source service registration cluster is pre-checked, the corresponding target service registration cluster can be automatically deployed based on the Kubernetes, so that the availability of the service registration cluster after upgrading is improved.
Referring to fig. 5, in the third embodiment, based on the first embodiment, after step S10, further includes:
step S60, adjusting a self-protection duration percentage threshold factor of the service registration cluster, and controlling the source service registration cluster to enter a self-protection mode when detecting that the heartbeat request feedback time of the source service registration cluster is longer than a preset time, so as to improve the corresponding waiting time of the heartbeat request and avoid the service instance of the service registration client from being removed.
In this embodiment, even if the binding relationship between the external route and the internal route of the eurka cluster is switched, a certain time difference still exists between the external route and the corresponding BACKEND (POD IP) information update, which causes a part of the requests of the eurka clients to enter the target eurka cluster first, and a part of the requests of the eurka clients stay in the source eurka cluster, resulting in traffic loss of the eurka clients. Based on this, in such an extreme scenario, a self-protection mechanism may be set to perform, for example, adjusting a self-protection duration percentage threshold factor (eureka. Server. Renew-per-threshold) to 0.49, thereby improving the protection duration of the service instance.
The heartbeat request feedback time is longer than the preset time, which indicates that the current Eureka client request is not sent to the target Eureka cluster, and the source Eureka cluster needs to be controlled to enter the self-protection mode at the moment, so that the waiting time is prolonged, and the service instance of the Eureka client is prevented from being removed due to the fact that the preset time is exceeded.
For example, if the current service instance protection duration is 90 seconds, the self-protection continuation percentage threshold factor is set to be 0.49, so that the heartbeat judgment duration of the service instance is improved based on the self-protection continuation percentage threshold factor, and then when the heartbeat of the source Eureka cluster is rapidly reduced, the self-protection mode is entered, so that the service instance of the source Eureka cluster is prevented from being removed.
It should be noted that the above data are only for explanation, and are not meant as limitations of the present invention.
Alternatively, in addition to this, a heartbeat request may be sent to the target service registration cluster based on a preset time interval until the heartbeat request is not received in the source service registration cluster, so that the request of the service registration client is sent to the target service registration cluster. That is, by sending the simulated heartbeat request, the situation that the target Eurka cluster cannot receive the request sent by the current Eurka client is avoided, and when the source Eurka cluster cannot receive the heartbeat request, all the requests indicating the Eurka client are sent to the target Eurka cluster is avoided.
In the technical solution disclosed in this embodiment, in order to avoid that the message of the eurka client cannot be sent to the source eurka cluster in an extreme scenario, at this time, the self-protection continuation percentage threshold factor may be adjusted so as to improve the heartbeat request feedback time, so that the service instance of the eurka client is prevented from being removed too early, and meanwhile, the current heartbeat request may be imitated, the heartbeat request is sent to the target eurka cluster at regular time until the source eurka cluster cannot receive the heartbeat request, and further, the request of the eurka client is guaranteed to be sent to the target eurka, so that even if the traffic of the eurka client still exists in the source eurka cluster, service discovery can be performed normally, thereby guaranteeing the continuity of the service.
In the fourth embodiment, a specific flow of the service registration cluster traffic switching method is shown in fig. 6.
In this embodiment, all source eurka clusters are in a to-be-executed state by default, and when a user enters a pre-checking stage through a visual interface or a code input manner, one or more source eurka clusters can enter the pre-checking stage, in which a source eurka cluster upgrading action of which a domain name distribution policy is balanced and registered by using POD IP is blocked, or a source eurka cluster upgrading action of which a current eurka cluster cannot be upgraded can be output under a condition that a eurka client uses internal routing to communicate with the source eurka clusters is blocked. And then judging whether the source Eureka cluster which does not meet the conditions passes the pre-check, outputting a prompt for entering the next step, in the next step, namely the high available instance deployment step, deploying a corresponding target Eureka cluster for the source Eureka cluster which meets the upgrading conditions based on Kubernetes, after the deployment is finished, checking whether the state of each node of the target Eureka cluster is UP, whether DS Replicas of each node are complete and consistent, whether a/Eureka/apps interface of each node returns normally or not based on the received confirmation instruction, and judging whether the ready check passes or not based on the detection result.
With continued reference to fig. 6, after the target eurka cluster ready check passes, based on the obtained execution instruction, a service instance snapshot of the source eurka cluster to be upgraded is obtained, and service instances of the same data are registered for the target eurka cluster according to the service instance snapshot, that is, synchronization of the source eurka cluster and the target eurka cluster is achieved. And further checking the synchronization result, and when the number of the registration services and the number of the registration instances are the same, switching the flow, namely modifying the spec.to.name attribute of the Route resource object into the Service resource object name corresponding to the target Eureka cluster, so that the flow request of the Eureka client can be sent to the target Eureka cluster. In the process of example synchronous starting, a corresponding protection mechanism is required to be set for the target Eureka cluster, a flow request sent by the Eureka client can be verified based on the protection mechanism, after verification is passed, the example synchronous task is stopped, registration information of the target Eureka cluster is checked, and metadata is updated after the check is passed. Based on this, the completion process of upgrading the source Eureka cluster to the target Eureka cluster is achieved.
In the technical scheme disclosed in this embodiment, in the process of upgrading the source eurka cluster, it is necessary to perform upgrade verification of the source eurka cluster, deployment of a corresponding target eurka cluster and inspection after deployment of the target eurka cluster, then execute an instance information synchronization task after receiving a corresponding instruction from a user, and continue to perform flow switching based on the user instruction after the instance information synchronization is completed, verification after the flow switching, and stopping of the instance synchronization task after the verification is passed, and finally perform registration information inspection on the target eurka cluster, and complete updating of metadata after the inspection is passed. In the flow upgrading switching process of the complete source Eurka cluster, a user can check the upgrading process of the source Eurka cluster in real time, and execute the flow upgrading switching action of the next stage based on a confirmation instruction input by the user in each stage, so that the upgrading process of the source Eurka cluster can be displayed in a visual mode, whether the upgrading action is continuously executed or not can be controlled in real time, operability of the source Eurka cluster in upgrading and practicability after upgrading are improved, and interruption of Eurka client business can be avoided.
Referring to fig. 7, fig. 7 is a schematic diagram of a terminal structure of a hardware running environment according to an embodiment of the present invention.
As shown in fig. 7, the terminal may include: a processor 1001, such as a central processing unit (Central Processing Unit, CPU), a communication bus 1002, a network interface 1003, and a memory 1004. Wherein the communication bus 1002 is used to enable connected communication between these components. The network interface 1003 may optionally include a standard wired interface, a WIreless interface (e.g., a WIreless-FIdelity (WI-FI) interface). The Memory 1004 may be a high-speed RAM Memory (Random Access Memory, RAM) or a stable Non-Volatile Memory (NVM), such as a disk Memory. The memory 1004 may also optionally be a storage device separate from the processor 1001 described above.
It will be appreciated by those skilled in the art that the terminal structure shown in fig. 7 is not limiting of the terminal and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
As shown in fig. 7, an operating system, a data storage module, a network communication module, and a flow switching program may be included in the memory 1004, which is one type of computer storage medium.
In the terminal shown in fig. 7, the network interface 1003 is mainly used for connecting to a background server, and performing data communication with the background server; the processor 1001 may call a flow switching program stored in the memory 1004 and perform the following operations:
after the source service registration cluster to be upgraded passes the ready check of the corresponding target service registration cluster, registering a target service instance for the target service registration cluster according to the service instance snapshot of the source service registration cluster;
when the number of the registration services and the number of the registration instances corresponding to the target service registration cluster are the same as the data corresponding to the source service registration cluster, modifying an internal route address associated with an external route of the source service registration cluster into a service node corresponding to the target service registration cluster;
and after receiving the flow request of the service registration client, routing the flow request to the target service registration cluster.
Further, the processor 1001 may call a flow switching program stored in the memory 1004, and further perform the following operations:
after the source service registration cluster is pre-checked, automatically deploying the target service registration cluster corresponding to the source service registration cluster based on a container application management platform;
And when the state of each node of the target service registration cluster is UP, DS replies of each node are complete and consistent, and an interface of each node returns normally, judging that the ready detection of the target service registration cluster passes.
Further, the processor 1001 may call a flow switching program stored in the memory 1004, and further perform the following operations:
after receiving an upgrade instruction of the source service registration cluster, determining a domain name distribution strategy of the source service registration cluster;
if the domain name distribution strategy is balanced distribution, and a service registration client uses an IP address to register in the source service registration cluster, judging that the source service registration cluster fails to pre-check, and terminating the upgrading action of the source service registration cluster; or alternatively
After determining a domain name distribution strategy of the source service registration cluster, judging that the source service registration cluster fails to pre-check when detecting that the service registration client uses an internal route to communicate with the source service registration cluster, and terminating the upgrading action of the source service registration cluster; otherwise
And judging that the source service registration cluster pre-check passes.
Further, the processor 1001 may call a flow switching program stored in the memory 1004, and further perform the following operations:
Adjusting a self-protection duration percentage threshold factor of the service registration cluster, and controlling the source service registration cluster to enter a self-protection mode when detecting that the heartbeat request feedback time of the source service registration cluster is longer than a preset time, so as to improve the corresponding waiting time of the heartbeat request and avoid the service instance of the service registration client to be removed; or alternatively
And sending a heartbeat request to the target service registration cluster based on a preset time interval until the heartbeat request is not received in the source service registration cluster, so that the request of the service registration client is sent to the target service registration cluster.
Further, the processor 1001 may call a flow switching program stored in the memory 1004, and further perform the following operations:
when the number of the registration services and the number of the registration instances corresponding to the target service registration cluster are the same as the data corresponding to the source service registration cluster, determining the binding relation between the external route and the internal route of the source service registration cluster;
when the internal routing address associated with the external routing is a source service node of the source service registration cluster, modifying the internal routing address to the service node of the target service registration cluster.
Further, the processor 1001 may call a flow switching program stored in the memory 1004, and further perform the following operations:
after restarting the source service registration cluster, if the message number of the source service registration cluster is empty, judging that the source service registration cluster flow switching is successful;
and deleting the related container resources of the source service registration cluster.
Further, the processor 1001 may call a flow switching program stored in the memory 1004, and further perform the following operations:
after the source service registration cluster to be upgraded passes the corresponding target service registration cluster ready inspection, obtaining the service instance snapshot of the source service registration cluster, and storing the service instance snapshot into a disk so that the source service registration cluster can perform data rollback operation;
and registering the target service instance for the target service registration cluster according to the service instance snapshot.
Further, the processor 1001 may call a flow switching program stored in the memory 1004, and further perform the following operations:
outputting a visual operation interface of the source service registration cluster upgrade;
and executing corresponding upgrading actions according to the operation instructions of the visual operation interface, and automatically completing upgrading verification and flow switching tasks of the source service registration cluster.
Furthermore, it will be appreciated by those of ordinary skill in the art that implementing all or part of the processes in the methods of the above embodiments may be accomplished by computer programs to instruct related hardware. The computer program comprises program instructions, and the computer program may be stored in a storage medium, which is a computer readable storage medium. The program instructions are executed by at least one processor in the control terminal to carry out the flow steps of the embodiments of the method described above.
Accordingly, the present application also provides a computer-readable storage medium storing a traffic switching program which, when executed by a processor, implements the steps of the service registration cluster traffic switching method described in the above embodiments.
It should be noted that, because the storage medium provided in the embodiments of the present application is a storage medium used for implementing the method in the embodiments of the present application, based on the method described in the embodiments of the present application, a person skilled in the art can understand the specific structure and the modification of the storage medium, and therefore, the description thereof is omitted herein. All storage media adopted by the method of the embodiment of the application belong to the scope of protection of the application.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flowchart and/or block of the flowchart illustrations and/or block diagrams, and combinations of flowcharts and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (10)

1. The service registration cluster traffic switching method is characterized by comprising the following steps:
after the source service registration cluster to be upgraded passes the ready check of the corresponding target service registration cluster, registering a target service instance for the target service registration cluster according to the service instance snapshot of the source service registration cluster;
When the number of the registration services and the number of the registration instances corresponding to the target service registration cluster are the same as the data corresponding to the source service registration cluster, modifying an internal route address associated with an external route of the source service registration cluster into a service node corresponding to the target service registration cluster;
and after receiving the flow request of the service registration client, routing the flow request to the target service registration cluster.
2. The service registration cluster traffic switching method according to claim 1, wherein after the source service registration cluster to be upgraded and the corresponding target service registration cluster ready check pass, before the step of registering the target service instance for the target service registration cluster according to the service instance snapshot of the source service registration cluster, the method further comprises:
after the source service registration cluster is pre-checked, automatically deploying the target service registration cluster corresponding to the source service registration cluster based on a container application management platform;
and when the state of each node of the target service registration cluster is UP, DS replies of each node are complete and consistent, and an interface of each node returns normally, judging that the ready detection of the target service registration cluster passes.
3. The service registration cluster traffic switching method according to claim 2, further comprising, after the source service registration cluster pre-inspection passes, automatically deploying the target service registration cluster corresponding to the source service registration cluster based on a container application management platform:
after receiving an upgrade instruction of the source service registration cluster, determining a domain name distribution strategy of the source service registration cluster;
if the domain name distribution strategy is balanced distribution, and a service registration client uses an IP address to register in the source service registration cluster, judging that the source service registration cluster fails to pre-check, and terminating the upgrading action of the source service registration cluster; or alternatively
After determining a domain name distribution strategy of the source service registration cluster, judging that the source service registration cluster fails to pre-check when detecting that the service registration client uses an internal route to communicate with the source service registration cluster, and terminating the upgrading action of the source service registration cluster; otherwise
And judging that the source service registration cluster pre-check passes.
4. The service registration cluster traffic switching method according to claim 1, wherein after the source service registration cluster to be upgraded and the corresponding target service registration cluster ready check passes, the step of registering the target service instance for the target service registration cluster according to the service instance snapshot of the source service registration cluster further comprises:
Adjusting a self-protection duration percentage threshold factor of the service registration cluster, and controlling the source service registration cluster to enter a self-protection mode when detecting that the heartbeat request feedback time of the source service registration cluster is longer than a preset time, so as to improve the corresponding waiting time of the heartbeat request and avoid the service instance of the service registration client to be removed; or alternatively
And sending a heartbeat request to the target service registration cluster based on a preset time interval until the heartbeat request is not received in the source service registration cluster, so that the request of the service registration client is sent to the target service registration cluster.
5. The service registration cluster traffic switching method according to claim 1, wherein when the number of registration services and the number of registration instances corresponding to the target service registration cluster are the same as the data corresponding to the source service registration cluster, the step of modifying the internal routing address associated with the external routing of the source service registration cluster to the service node corresponding to the target service registration cluster includes:
when the number of the registration services and the number of the registration instances corresponding to the target service registration cluster are the same as the data corresponding to the source service registration cluster, determining the binding relation between the external route and the internal route of the source service registration cluster;
When the internal routing address associated with the external routing is a source service node of the source service registration cluster, modifying the internal routing address to the service node of the target service registration cluster.
6. The service registration cluster traffic switching method according to claim 1, wherein after the step of routing the traffic request to the target service registration cluster after receiving the traffic request of the service registration client, the method further comprises:
after restarting the source service registration cluster, if the number of service registration instances of the source service registration cluster is empty, judging that the source service registration cluster flow switching is successful;
and deleting the related container resources of the source service registration cluster.
7. The service registration cluster traffic switching method according to claim 1, wherein after the source service registration cluster to be upgraded and the corresponding target service registration cluster ready check passes, the step of registering the target service instance for the target service registration cluster according to the service instance snapshot of the source service registration cluster includes:
after the source service registration cluster to be upgraded passes the corresponding target service registration cluster ready inspection, obtaining the service instance snapshot of the source service registration cluster, and storing the service instance snapshot into a disk so that the source service registration cluster can perform data rollback operation;
And registering the target service instance for the target service registration cluster according to the service instance snapshot.
8. The service registration cluster traffic switching method of claim 1, wherein the method further comprises:
outputting a visual operation interface of the source service registration cluster upgrade;
and executing corresponding upgrading actions according to the operation instructions of the visual operation interface, and automatically completing upgrading verification and flow switching tasks of the source service registration cluster.
9. A flow switching device, characterized in that the flow switching device comprises: memory, a processor and a traffic switching program stored on the memory and executable on the processor, which when executed by the processor implements the steps of the service registration cluster traffic switching method according to any one of claims 1 to 8.
10. A computer readable storage medium, wherein a traffic switching program is stored on the computer readable storage medium, which when executed by a processor, implements the steps of the service registration cluster traffic switching method according to any one of claims 1 to 8.
CN202310729917.4A 2023-06-16 2023-06-16 Service registration cluster flow switching method, flow switching device and storage medium Pending CN116743762A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310729917.4A CN116743762A (en) 2023-06-16 2023-06-16 Service registration cluster flow switching method, flow switching device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310729917.4A CN116743762A (en) 2023-06-16 2023-06-16 Service registration cluster flow switching method, flow switching device and storage medium

Publications (1)

Publication Number Publication Date
CN116743762A true CN116743762A (en) 2023-09-12

Family

ID=87904255

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310729917.4A Pending CN116743762A (en) 2023-06-16 2023-06-16 Service registration cluster flow switching method, flow switching device and storage medium

Country Status (1)

Country Link
CN (1) CN116743762A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118245196A (en) * 2024-05-24 2024-06-25 济南浪潮数据技术有限公司 Application switching method, device, equipment, storage medium and computer program product

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118245196A (en) * 2024-05-24 2024-06-25 济南浪潮数据技术有限公司 Application switching method, device, equipment, storage medium and computer program product

Similar Documents

Publication Publication Date Title
CN113169952B (en) Container cloud management system based on block chain technology
CN104410672B (en) Method, the method and device of forwarding service of network function virtualization applications upgrading
CN112506617B (en) Mirror image updating method and device for side car containers in Kubernetes cluster
CN107967140B (en) Software modification initiating method, metadata publishing method and device
KR20060051932A (en) Updating software while it is running
CN109639818B (en) Service discovery method and device under cloud environment, server and storage medium
CN106953746A (en) Clustered node upgrade-system and method
EP3879875A1 (en) Resource change method and device, apparatus, and storage medium
CN114448895B (en) Application access method, device, equipment and medium
KR20130061734A (en) Cloud-shared resource providing system
EP4050850A1 (en) Service upgrading method, device and system
CN114168179B (en) Micro-service management method, micro-service management device, computer equipment and storage medium
CN116743762A (en) Service registration cluster flow switching method, flow switching device and storage medium
CN106708539A (en) Client updating method and device
CN111131131B (en) Vulnerability scanning method and device, server and readable storage medium
CN109120680B (en) Control system, method and related equipment
CN112256351B (en) Method for realizing Feign component, method and device for calling micro-service
CN104104701A (en) Online service configuration updating method and system
CN116225617A (en) Management migration method and device for container instance, electronic equipment and storage medium
CN114662102A (en) File processing method and device and storage medium
CN111930626B (en) Automatic testing method and device based on PaaS cloud service
CN114564530A (en) Database access method, device, equipment and storage medium
CN114662103A (en) File processing method and device and storage medium
CN107317880B (en) Method and device for realizing load balance
KR20150137766A (en) System and method for creating stack of virtual machine

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