CN114465878A - Service port switching method and device - Google Patents

Service port switching method and device Download PDF

Info

Publication number
CN114465878A
CN114465878A CN202210187552.2A CN202210187552A CN114465878A CN 114465878 A CN114465878 A CN 114465878A CN 202210187552 A CN202210187552 A CN 202210187552A CN 114465878 A CN114465878 A CN 114465878A
Authority
CN
China
Prior art keywords
service
port
grid
switching
instance
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
CN202210187552.2A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210187552.2A priority Critical patent/CN114465878A/en
Publication of CN114465878A publication Critical patent/CN114465878A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0663Performing the actions predefined by failover planning, e.g. switching to standby network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0668Management of faults, events, alarms or notifications using network fault recovery by dynamic selection of recovery network elements, e.g. replacement by the most appropriate element after failure
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0817Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning

Abstract

The invention provides a service port switching method and device, relates to the technical field of service architecture, and can be used in the financial field or other technical fields. The method comprises the following steps: carrying out fault monitoring on a grid instance of a service grid port for service priority calling; if the grid instance of the service grid port fails, the micro-service port is switched to be in an available state, and the service grid port is in an unavailable state. The device performs the above method. The service port switching method and the device provided by the embodiment of the invention realize hot switching without rolling back the service mirror image, reduce the work of maintaining the mirror image and the time required for rolling back and restarting the service mirror image, reduce the labor cost and improve the switching efficiency.

Description

Service port switching method and device
Technical Field
The invention relates to the technical field of service architecture, in particular to a service port switching method and device.
Background
With the popularity of distributed micro-services, a service grid is taken as a new distributed service architecture, which brings better technical benefits, but the service grid still has a certain difference from the traditional micro-service architecture in terms of deployment, operation and maintenance architecture, and a disaster tolerance scheme for smooth migration is needed while business application evolves to the service grid, so that when the service grid fails, the original micro-service system can be quickly switched back:
the existing service grid is greatly different from a micro-service framework deployment architecture, a service mirror image of a service grid system needs to be adapted independently, once the service grid system fails, sidecar injection configuration of the service grid needs to be closed from a basic deployment platform Paas (Kubernetes), and then the service mirror image (mirror image unsuitable for the version of the service grid system) is rolled back. The emergency service mirror image corresponding to the non-grid version needs to be maintained at the same time, the labor cost is high, the number of steps for executing the rollback operation is large, the shutdown rollback is needed, the mirror image needs to be restarted, and the influence time is long.
Disclosure of Invention
To solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for switching a service port, which can at least partially solve the problems in the prior art.
In one aspect, the present invention provides a method for switching a service port, including:
carrying out fault monitoring on a grid instance of a service grid port for service priority calling;
if the grid instance of the service grid port fails, the micro-service port is switched to be in an available state, and the service grid port is in an unavailable state.
The service port switching method further comprises the following steps:
if the grid instance of the service grid port is monitored to be free from the fault, the service grid port is switched to be in the available state, and the micro-service port is in the unavailable state.
Wherein, if the grid instance of the service grid port is monitored to have a fault, switching the micro service port to be in an available state, and the service grid port to be in an unavailable state, comprising:
if the grid instance of the service grid port fails, controlling a dynamic switch preset at a target client to be switched to the micro-service port through a configuration center;
if the grid instance of the service grid port is monitored to be free from the fault, switching the service grid port to be in an available state, and switching the micro-service port to be in an unavailable state, wherein the switching comprises the following steps:
and if the grid instance of the service grid port is monitored to be free from the fault, controlling a dynamic switch preset on the target client to be switched to the service grid port through a configuration center.
The service port switching method further comprises the following steps:
acquiring a metadata identification bit of a service in a registry, and displaying the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports.
The service port switching method further comprises the following steps:
carrying out fault monitoring on a grid instance of a service grid port for service priority calling to obtain historical fault monitoring data;
and if the ratio of the service grid port with the fault in the historical fault monitoring data to all the service grid ports is larger than a preset ratio, switching the service port which is called by service priority into a micro service port.
In one aspect, the present invention provides a method for switching a service port, including:
responding to a control message of the service port switched to the available state;
executing a service port switching action for switching to the available state according to the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports.
Wherein, before the step of responding to the control message of the service port switched to the available state, the service port switching method further comprises:
and setting a dynamic switch and establishing a corresponding relation with a configuration center in the central server.
Before the step of setting the dynamic switch and establishing the corresponding relationship with the configuration center in the central server, the service port switching method further includes:
configuring service grid adaptation information, so that when a service initiates registration, the central server displays a service grid port and a micro-service port in a registration center according to the service grid adaptation information and generates the metadata identification bit.
In one aspect, the present invention provides a service port switching apparatus, including:
the monitoring unit is used for monitoring the fault of the grid instance of the service grid port which is called by the service priority;
and the switching unit is used for switching the micro service port to be in an available state and the service grid port to be in an unavailable state if the grid instance of the service grid port is monitored to have a fault.
In one aspect, the present invention provides a service port switching apparatus, including:
the response module is used for responding to the control message of the service port switched to the available state;
the execution module is used for executing the service port switching action of switching to the available state according to the metadata identification bit; the metadata identification bit marks a service grid port or a micro-service port,
In another aspect, an embodiment of the present invention provides an electronic device, including: a processor, a memory, and a bus, wherein,
the processor and the memory are communicated with each other through the bus;
the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform a method comprising:
carrying out fault monitoring on a grid instance of a service grid port for service priority calling;
if the grid instance of the service grid port fails, switching the micro service port to be in an available state, and switching the service grid port to be in an unavailable state;
or responding to a control message of the service port switched to the available state;
executing a service port switching action for switching to the available state according to the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports.
An embodiment of the present invention provides a non-transitory computer-readable storage medium, including:
the non-transitory computer readable storage medium stores computer instructions that cause the computer to perform a method comprising:
carrying out fault monitoring on a grid instance of a service grid port for service priority calling;
if the grid instance of the service grid port fails, switching the micro service port to be in an available state, and switching the service grid port to be in an unavailable state;
or responding to a control message of the service port switched to the available state;
executing a service port switching action for switching to the available state according to the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports.
The service port switching method and the device provided by the embodiment of the invention carry out fault monitoring on the grid instance of the service grid port which is called by service priority; if the grid instance of the service grid port is monitored to be in fault, the micro-service port is switched to be in an available state, the service grid port is in an unavailable state, hot switching is realized, the service mirror image does not need to be rolled back, the time required by the work of maintaining the mirror image and the time required by rolling back and restarting the service mirror image is reduced, the labor cost is reduced, and the switching efficiency is improved.
The service port switching method and the device provided by the embodiment of the invention carry out fault monitoring on the grid instance of the service grid port which is called by service priority; if the grid instance of the service grid port is monitored to be in fault, the micro service port is switched to be in an available state, the service grid port is in an unavailable state, the target terminal responds to the control message of the service port switched to the available state, the service port switched to the available state is switched in a hot mode, the service mirror image does not need to be rolled back, the work of maintaining the mirror image and the time required for rolling back and restarting the service mirror image are reduced, the labor cost is reduced, and the switching efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
fig. 1 is a flowchart illustrating a service port switching method according to an embodiment of the present invention.
Fig. 2 is a schematic structural relationship diagram of a central server and a client according to another embodiment of the present invention.
Fig. 3 is a flowchart illustrating a service port switching method according to another embodiment of the present invention.
FIG. 4 is an illustration of a default priority access service grid port in accordance with an embodiment of the present invention.
Fig. 5 is a schematic diagram illustrating switching to access a microservice port according to an embodiment of the present invention.
Fig. 6 is a schematic structural diagram of a service port switching apparatus according to an embodiment of the present invention.
Fig. 7 is a schematic structural diagram of a service port switching apparatus according to another embodiment of the present invention.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
Fig. 1 is a schematic flowchart of a service port switching method according to an embodiment of the present invention, and as shown in fig. 1, the service port switching method according to the embodiment of the present invention includes:
step S1: and carrying out fault monitoring on the grid instances of the service grid ports of the service priority calling.
Step S2: if the grid instance of the service grid port fails, the micro-service port is switched to be in an available state, and the service grid port is in an unavailable state.
In the above step S1, the device performs fault monitoring on the grid instance of the service grid port to which the service is preferentially invoked. The apparatus may be a computer device for executing the method, and may include, for example, a central server, as shown in fig. 2, including a configuration center and a registration center therein; wherein:
the configuration center is used for carrying out centralized configuration on the information of the client managed by the central server.
The registry performs registration management on the services of the client managed by the central server.
The client managed by the central server can be a plurality of clients, and each client internally comprises a service grid architecture and a micro-service architecture.
A Service Mesh refers to a configurable infrastructure layer (configurable infrastructure layer) for microservice applications. It makes communication between each service instance more fluid, reliable and rapid. The service grid provides a range of functions such as service discovery, load balancing, encryption, authentication, authorization, fuse mode (Circuit Breaker Pattern) support, and others.
The implementation of the service grid is usually to provide an instance of a proxy, which we call "sidecar". The sidecar is included in each service. The sidecar handles mainly inter-service communication, monitoring, and some security related considerations, i.e. any part of the security aspects that can be abstracted from the service ontology. In this way, developers can focus on development, support, and maintenance in the service; the operation and maintenance personnel can maintain the service grid and run apps. Service grid architectures may include Dubbo, Spring Cloud, APP, SDK, and sidecar.
Wherein Spring Cloud is an ordered set of a series of frames. The development convenience of the Spring Boot is utilized to skillfully simplify the development of infrastructure of a distributed system, such as service discovery registration, configuration center, message bus, load balancing, circuit breaker, data monitoring and the like, and the Spring Boot can be used for one-key starting and deployment in a development style.
Sidecar, which is a process that splits the functionality that would otherwise belong to an application into separate processes, can be understood as Sidecar. In a micro-service system, micro-service functions integrated in an application are separated into a sidecar, and the sidecar provides functions of micro-service discovery, registration, service calling, application authentication, speed limitation and the like.
Dubbo is a service framework that enables applications to implement the output and input functions of a service through high performance RPC, which can be seamlessly integrated with the Spring framework.
A service grid port may be understood as a communication interface of a service grid.
Micro-services, a variant of the software development technology, Service Oriented Architecture (SOA) architectural style, advocates dividing a single application into a set of small services, which are coordinated and coordinated to provide the final value to the user. Each service runs in its own independent process, and the services communicate with each other by adopting a lightweight communication mechanism (usually, HTTP-based RESTful API). Each service is built around a specific business and can be deployed independently to a production environment, a production-like environment, and the like. In addition, a unified and centralized service management mechanism should be avoided as much as possible, and for a specific service, a suitable language and tool should be selected and constructed according to the context.
Microservice architectures may include Dubbo, Spring Cloud, APP, and SDK.
Dubbo and Spring Cloud can be referred to above, with APP and SDK being generic terms in the art.
A microservice port may be understood as a communication interface to a microservice.
Since the service grid architecture is a new distributed service architecture and is superior to the micro-service architecture as a whole, the service calls the service grid port preferentially.
The service instance calling the service grid port is called a grid instance; similarly, a service instance that calls a microservice port is referred to as a microservice instance.
The fault monitoring of the grid instances of the service grid ports, which are called by service priority in each client, can be realized through the existing mature technology, and the client corresponding to the network instance with the fault is taken as the target client.
In step S2, if the device detects that the mesh instance of the serving mesh port fails, the device switches the micro-service port to the available state and the serving mesh port to the unavailable state. Referring to the above description, the micro service port in the target client may be switched to an available state, and the service mesh port may be switched to an unavailable state.
If the grid instance of the service grid port fails, switching the micro service port to be in an available state, and switching the service grid port to be in an unavailable state, wherein the switching comprises the following steps:
if the grid instance of the service grid port fails, the dynamic switch preset on the target client is controlled to be switched to the micro service port through the configuration center. A control message may be sent to the target client, such that the target client switches the dynamic switch of the target client to the micro service port in response to the control message. The switching target carried by the control message is a micro service port.
The dynamic switches may be set in each client in advance, and a corresponding relationship with the configuration center in the central server may be established, where the corresponding relationship may include a client number, a dynamic switch number, and a corresponding configuration center number, and it may be understood that the client numbers and the dynamic switch numbers correspond to one another, and the client numbers and the dynamic switch numbers of multiple clients may correspond to the same configuration center number.
The service port switching method further comprises the following steps:
if the grid instance of the service grid port is monitored to be free from the fault, the service grid port is switched to be in the available state, and the micro-service port is in the unavailable state.
The client corresponding to the network instance with the resolved failure may be used as the target client.
If the grid instance of the service grid port is monitored to be free from the fault, switching the service grid port to be in an available state, and switching the micro-service port to be in an unavailable state, wherein the switching comprises the following steps:
and if the grid instance of the service grid port is monitored to be free from the fault, controlling a dynamic switch preset on the target client to be switched to the service grid port through a configuration center. A control message may be sent to the target client to cause the target client to switch the dynamic switch of the target client to the service grid port in response to the control message. The handover target carried by the control message is a serving mesh port.
The description of the dynamic switch is set in each client in advance, and is not described in detail.
The service port switching method provided by the embodiment of the invention carries out fault monitoring on the grid instance of the service grid port which is called by service priority; if the grid instance of the service grid port is monitored to be in fault, the micro-service port is switched to be in an available state, the service grid port is in an unavailable state, hot switching is realized, the service mirror image does not need to be rolled back, the time required by the work of maintaining the mirror image and the time required by rolling back and restarting the service mirror image is reduced, the labor cost is reduced, and the switching efficiency is improved.
Further, the service port switching method further includes:
if the grid instance of the service grid port is monitored to be free from the fault, the service grid port is switched to be in the available state, and the micro-service port is in the unavailable state. Reference is made to the above description and no further description is made.
The service port switching method provided by the embodiment of the invention ensures that the service calls the service grid port preferentially.
Further, if it is monitored that a grid instance of a service grid port fails, switching the micro service port to an available state and the service grid port to an unavailable state includes:
if the grid instance of the service grid port fails, controlling a dynamic switch preset on a target client to be switched to the micro-service port through a configuration center; reference is made to the above description and no further description is made.
If the grid instance of the service grid port is monitored to be free from the fault, switching the service grid port to be in an available state, and switching the micro-service port to be in an unavailable state, wherein the switching comprises the following steps:
and if the grid instance of the service grid port is monitored to be free from the fault, controlling a dynamic switch preset on the target client to be switched to the service grid port through a configuration center. Reference is made to the above description and no further description is made.
The service port switching method provided by the embodiment of the invention completes the switching action by controlling the dynamic switch, thereby further improving the switching efficiency.
Further, the service port switching method further includes:
acquiring a metadata identification bit of a service in a registry, and displaying the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports. The microservice port may be labeled with a 0 and the service mesh port may be labeled with a 1.
By displaying the metadata identification bits, the target client can be conveniently instructed to switch the dynamic switch to the service grid port or the micro-service port.
The service port switching method provided by the embodiment of the invention is convenient for indicating the target client to switch the dynamic switch to the service grid port or the micro-service port.
Further, the service port switching method further includes:
carrying out fault monitoring on a grid instance of a service grid port for service priority calling to obtain historical fault monitoring data; the time limit of the historical fault monitoring data can be set independently according to actual conditions, and can be selected as historical fault monitoring data half year ago or historical fault monitoring data 1 year ago.
And if the ratio of the service grid port with the fault in the historical fault monitoring data to all the service grid ports is larger than a preset ratio, switching the service port which is called by service priority into a micro service port. The preset ratio can be set autonomously according to actual conditions, and can be in positive correlation change with the time limit of the historical fault monitoring data, namely the preset ratio corresponding to the historical fault monitoring data half year ago can be smaller than the preset ratio corresponding to the historical fault monitoring data 1 year ago.
It should be noted that if a service grid port has multiple failures, it can be marked as a failure and participate in the above calculation.
If the grid instance of the service grid port is determined to have a large-scale fault through the historical data, the service grid is not stable enough, and the service port called by the default service priority can be switched to the micro-service port.
The service port switching method provided by the embodiment of the invention further ensures that the service is normally carried out by setting the service port which is preferentially called by the default service.
Fig. 3 is a flowchart illustrating a service port switching method according to an embodiment of the present invention, and as shown in fig. 3, the service port switching method according to the embodiment of the present invention includes:
step R1: responding to the control message of the service port switched to the available state.
Step R2: executing a service port switching action for switching to the available state according to the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports.
In the above step R1, the device responds to the control message of the service port switched to the available state. The apparatus may be a computer device that performs the method, and may include, for example, a client, as shown in fig. 2, including within the client a microservice architecture and a services grid architecture. The control message may be sent by the central server to the target client, that is, the target client responds to the control message for switching to the service port in the available state, and the message carries an indication that the service port to which the terminal is switched is the service mesh port or the micro service port.
In the above step R2, the device performs a service port switching action to the available state according to the metadata flag; the metadata identification bits mark service mesh ports or microservice ports. Referring to the above description, if the metadata flag is 0, a micro service port switching action to an available state is performed; if the metadata identification bit is 1, a service mesh port switching action to an available state is performed.
The service port switching method provided by the embodiment of the invention carries out fault monitoring on the grid instance of the service grid port which is called by service priority; if the grid instance of the service grid port fails, the micro-service port is switched to the available state, the service grid port is in the unavailable state, the target terminal responds to the control message of the service port switched to the available state, the service port switched to the available state is hot switched, the service mirror image does not need to be rolled back, the work of maintaining the mirror image and the time required for rolling back and restarting the service mirror image are reduced, the labor cost is reduced, and the switching efficiency is improved.
Further, before the step of responding to the control message of the service port switched to the available state, the service port switching method further includes:
and setting a dynamic switch and establishing a corresponding relation with a configuration center in the central server. At this time, since the control message is not received, the target client having the fault is not determined, that is, the client sets the dynamic switch, and establishes the corresponding relationship with the configuration center in the central server. The corresponding relationship may include a client number, a dynamic switch number, and a corresponding configuration center number, and it may be understood that the client numbers and the dynamic switch numbers correspond to one another, and the client numbers and the dynamic switch numbers of a plurality of clients may correspond to the same configuration center number.
The service port switching method provided by the embodiment of the invention further facilitates the control of the dynamic switch through the configuration center.
Further, before the step of setting a dynamic switch and establishing a corresponding relationship with a configuration center in a central server, the service port switching method further includes:
configuring service grid adaptation information, so that when a service initiates registration, the central server displays a service grid port and a micro-service port in a registration center according to the service grid adaptation information and generates the metadata identification bit. A service grid adaptation layer can be configured in a micro-service architecture in a client to realize configuration of service grid adaptation information, when a service initiates registration, two ports, one is a micro-service port and the other is a service grid port, are exposed in a registration center by the same service instance, and the generated metadata identification bit marks the micro-service port or the service grid port.
According to the service port switching method provided by the embodiment of the invention, the service grid port and the micro service port are displayed in the registration center, the metadata identification bit is generated, and the service port is further switched through the dynamic switch.
The method of the embodiment of the invention is explained as follows:
step 1): a service grid adaptation layer is configured in a client, when a service initiates registration, two ports are exposed in a registration center by the same service instance, one is a micro-service port, and the other is a service grid port. And exposes metadata at the registry indicating whether the grid port or the microservice port is serviced, respectively.
Step 2): a dynamic switch is arranged in a micro-service framework in a client, and a configuration center of a central server is connected with the dynamic switch to set whether the micro-service framework capability is enabled or not. If the switch is set to be closed, the service grid sidecar proxies the flow to realize the service calling service grid port.
Step 3): when the client side initiates service calling, the service grid port is called preferentially by default.
And step 4): when the grid example has a fault, the state of the switch can be switched by the configuration center, so that when the target client initiates service calling, the service grid port is not allowed to be called, and only the micro-service port is allowed to be called. Therefore, the method can realize quick hot switching in the process of not restarting or changing images. The basis for judging the service grid port or the micro-service port is the metadata identification bit on the service instance of the registration center.
Step 5): when the fault is relieved, the switch of the configuration center can be switched back to the strategy of preferentially calling the grid port.
The method of the embodiment of the present invention will be described in detail.
After the traditional micro service is accessed into the grid, the original service framework is not removed, and the micro service framework is selected to be completely used or the service grid is removed through an adapter by configuring a switch. As shown in fig. 2.
After the service in the service grid is started, the micro service frame exposes and registers a port, the service grid also exposes and registers a port, and the service grid or the exposed port of the micro service frame is marked by the metadata identification bit of the registration center.
Both ports normally exposed are capable of service communication, with the difference being one through the mesh sidecar proxy and one using the microservice framework capabilities. By default, client load balancing selects the exposed ports of the grid to perform load balancing instance screening, and initiates a request, as shown in fig. 4, which is described as follows:
1. the service provider sends its instance IP port (122.52.106.253: 28080) to the service provider's grid sidecar
2. The service provider's network sidecar sends the service provider's own instance IP port (122.52.106.253: 28080) and the service provider's grid sidecar's own instance IP port (122.52.106.253: 28081) to the registry for registration.
3. The service consumer sends the subscription service to the grid sidecar of the service consumer.
4. At this point the service consumer's grid sidecar returns a notification to the service consumer carrying its own instance IP port (127.0.0.1: 28082).
5. And also sends subscription services to the registry.
6. The registry sends a notification to the service consumer's grid sidecar carrying the service provider's own instance IP port (122.52.106.253: 28081/28080) of the network sidecar.
And the grid sidecar selects one of the examples (the micro-service frame example or the grid example) through the dynamic switch according to the metadata identification bit, the port establishes service communication between the network sidecar of the service consumer and the network sidecar of the service provider, and the data is transmitted to the service provider through the grid port after the service communication is established.
When a large-scale fault occurs in the service grid architecture, a central switch can be configured, so that only a micro-service port example is selected when a client performs load balancing screening, the grid port is shielded, the capability of a micro-service framework is enabled, and the appeal of rapid disaster recovery and hot switch is achieved. As shown in fig. 5, the following is illustrated:
1. the service provider sends its instance IP port (122.52.106.253: 28080) to the service provider's grid sidecar.
2. The service provider's network sidecar sends the service provider's own instance IP port (122.52.106.253: 28080) and the service provider's grid sidecar's own instance IP port (122.52.106.253: 28081) to the registry for registration.
3. The service consumer sends a subscription service to the registry.
4. The registry sends a notification to the service consumer carrying the service provider's own instance IP port (122.52.106.253: 28080).
The service consumer establishes service communication with the service provider, and after the service communication is established, data are transmitted to the grid sidecar of the service provider through the micro service port.
It should be noted that the service port switching method provided by the embodiment of the present invention may be used in the financial field, and may also be used in any technical field other than the financial field.
The embodiment of the invention can select the service grid port or the micro service port when the routing load is balanced and selected by reserving the capacity of the original micro service framework, double registering two ports and configuring the central switch, thereby achieving the capacity of fast hot switching, and compared with the prior art, the invention has the following beneficial effects:
1. the same mirror image can be rolled back without preparing a rolled back mirror image, thereby reducing the cost
2. The container is not required to be restarted, the hot back-cutting can be quickly carried out, and the failure time is reduced
3. The process is simplified in the deployment strategy, and the same mirror image of a set of templates can support the process.
Fig. 6 is a schematic structural diagram of a service port switching apparatus according to an embodiment of the present invention, and as shown in fig. 6, the service port switching apparatus according to the embodiment of the present invention includes a monitoring unit 601 and a switching unit 602, where:
the monitoring unit 601 is configured to perform fault monitoring on a grid instance of a service grid port where a service is preferentially called; the switching unit 602 is configured to switch the micro service port to an available state and the service mesh port to an unavailable state if it is monitored that the mesh instance of the service mesh port fails.
Specifically, a monitoring unit 601 in the device is configured to perform fault monitoring on a grid instance of a service grid port to which a service is preferentially called; the switching unit 602 is configured to switch the micro service port to an available state and the service mesh port to an unavailable state if it is monitored that the mesh instance of the service mesh port fails.
The service port switching device provided by the embodiment of the invention carries out fault monitoring on the grid instance of the service grid port which is called by service priority; if the grid instance of the service grid port is monitored to be in fault, the micro-service port is switched to be in an available state, the service grid port is in an unavailable state, hot switching is realized, the service mirror image does not need to be rolled back, the time required by the work of maintaining the mirror image and the time required by rolling back and restarting the service mirror image is reduced, the labor cost is reduced, and the switching efficiency is improved.
Further, the service port switching device is further configured to:
if the grid instance of the service grid port is monitored to be free from the fault, the service grid port is switched to be in the available state, and the micro-service port is in the unavailable state.
The service port switching device provided by the embodiment of the invention ensures that the service calls the service grid port preferentially.
Further, the switching unit 602 is configured to:
if the grid instance of the service grid port fails, controlling a dynamic switch preset on a target client to be switched to the micro-service port through a configuration center;
the service port switching device is further specifically configured to:
and if the grid instance of the service grid port is monitored to be free from the fault, controlling a dynamic switch preset on the target client to be switched to the service grid port through a configuration center.
The service port switching device provided by the embodiment of the invention completes the switching action by controlling the dynamic switch, thereby further improving the switching efficiency.
Further, the service port switching device is further configured to:
acquiring a metadata identification bit of a service in a registry, and displaying the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports.
The service port switching device provided by the embodiment of the invention is convenient for indicating the target client to switch the dynamic switch to the service grid port or the micro-service port.
Further, the service port switching device is further configured to:
and carrying out fault monitoring on the grid instance of the service grid port which is called by the service priority to obtain historical fault monitoring data.
And if the ratio of the service grid port with the fault in the historical fault monitoring data to all the service grid ports is larger than a preset ratio, switching the service port which is called by service priority into a micro service port.
The service port switching device provided by the embodiment of the invention further ensures that the service is normally carried out by setting the service port which is preferentially called by the default service.
Fig. 7 is a schematic structural diagram of a service port switching apparatus according to an embodiment of the present invention, and as shown in fig. 7, the service port switching apparatus according to the embodiment of the present invention includes a response module 701 and an execution module 702, where:
the response module 701 is configured to respond to a control message of a service port switched to an available state; the execution module 702 is configured to execute a service port switching action for switching to the available state according to the metadata identifier; the metadata identification bits mark service mesh ports or microservice ports.
Specifically, the response module 701 in the device is configured to respond to a control message of a service port switched to an available state; the execution module 702 is configured to execute a service port switching action for switching to the available state according to the metadata identifier; the metadata identification bits mark service mesh ports or microservice ports.
The service port switching device provided by the embodiment of the invention carries out fault monitoring on the grid instance of the service grid port which is called by service priority; if the grid instance of the service grid port is monitored to be in fault, the micro service port is switched to be in an available state, the service grid port is in an unavailable state, the target terminal responds to the control message of the service port switched to the available state, the service port switched to the available state is switched in a hot mode, the service mirror image does not need to be rolled back, the work of maintaining the mirror image and the time required for rolling back and restarting the service mirror image are reduced, the labor cost is reduced, and the switching efficiency is improved.
Further, the service port switching device is further configured to:
and setting a dynamic switch and establishing a corresponding relation with a configuration center in the central server.
The service port switching device provided by the embodiment of the invention further facilitates the control of the dynamic switch through the configuration center.
Further, the service port switching device is further configured to:
configuring service grid adaptation information, so that when a service initiates registration, the central server displays a service grid port and a micro-service port in a registration center according to the service grid adaptation information and generates the metadata identification bit.
The service port switching device provided by the embodiment of the invention displays the service grid port and the micro service port in the registration center, generates the metadata identification bit and further switches the service ports through the dynamic switch.
The embodiment of the service port switching apparatus provided in the embodiment of the present invention may be specifically configured to execute the processing flows of the above method embodiments, and the functions of the embodiment are not described herein again, and refer to the detailed description of the above method embodiments.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 8, the electronic device includes: a processor (processor)801, a memory (memory)802, and a bus 803;
the processor 801 and the memory 802 complete communication with each other through a bus 803;
the processor 801 is configured to call program instructions in the memory 802 to perform the methods provided by the above-described method embodiments, including for example:
carrying out fault monitoring on a grid instance of a service grid port for service priority calling;
if the grid instance of the service grid port fails, switching the micro service port to be in an available state, and switching the service grid port to be in an unavailable state;
or responding to a control message of the service port switched to the available state;
executing a service port switching action for switching to the available state according to the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports.
The present embodiment discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the method provided by the above-mentioned method embodiments, for example, comprising:
carrying out fault monitoring on a grid instance of a service grid port for service priority calling;
if the grid instance of the service grid port fails, switching the micro service port to be in an available state, and switching the service grid port to be in an unavailable state;
or responding to a control message of the service port switched to the available state;
executing a service port switching action for switching to the available state according to the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports.
The present embodiment provides a computer-readable storage medium, which stores a computer program, where the computer program causes the computer to execute the method provided by the foregoing method embodiments, for example, the method includes:
carrying out fault monitoring on a grid instance of a service grid port for service priority calling;
if the grid instance of the service grid port fails, switching the micro service port to be in an available state, and switching the service grid port to be in an unavailable state;
or responding to a control message of the service port switched to the available state;
executing a service port switching action for switching to the available state according to the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports.
As will be appreciated by one skilled in the art, 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 flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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.
In the description herein, reference to the description of the terms "one embodiment," "a particular embodiment," "some embodiments," "for example," "an example," "a particular example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (12)

1. A method for switching service ports, comprising:
carrying out fault monitoring on a grid instance of a service grid port for service priority calling;
if the grid instance of the service grid port fails, the micro-service port is switched to be in an available state, and the service grid port is in an unavailable state.
2. The service port switching method according to claim 1, wherein the service port switching method further comprises:
if the grid instance of the service grid port is monitored to be free from the fault, the service grid port is switched to be in the available state, and the micro-service port is in the unavailable state.
3. The method of claim 2, wherein switching the micro service port to an available state and the service mesh port to an unavailable state if it is monitored that the mesh instance of the service mesh port fails comprises:
if the grid instance of the service grid port fails, controlling a dynamic switch preset on a target client to be switched to the micro-service port through a configuration center;
if the grid instance of the service grid port is monitored to be free from the fault, switching the service grid port to be in an available state, and switching the micro-service port to be in an unavailable state, wherein the switching comprises the following steps:
and if the grid instance of the service grid port is monitored to be free from the fault, controlling a dynamic switch preset on the target client to be switched to the service grid port through a configuration center.
4. The method for switching service ports according to any of claims 1 to 3, further comprising:
acquiring a metadata identification bit of a service in a registry, and displaying the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports.
5. The method for switching service ports according to any of claims 1 to 3, further comprising:
carrying out fault monitoring on a grid instance of a service grid port for service priority calling to obtain historical fault monitoring data;
and if the ratio of the service grid port with the fault in the historical fault monitoring data to all the service grid ports is larger than a preset ratio, switching the service port which is called by service priority into a micro service port.
6. A method for switching service ports, comprising:
responding to a control message of the service port switched to the available state;
executing a service port switching action for switching to the available state according to the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports.
7. The service port switching method according to claim 6, wherein before the step of responding to the control message for switching to the service port in the available state, the service port switching method further comprises:
and setting a dynamic switch and establishing a corresponding relation with a configuration center in the central server.
8. The service port switching method according to claim 7, wherein before the step of setting the dynamic switch and establishing the correspondence relationship with the configuration center in the central server, the service port switching method further comprises:
configuring service grid adaptation information, so that when a service initiates registration, the central server displays a service grid port and a micro-service port in a registration center according to the service grid adaptation information and generates the metadata identification bit.
9. A service port switching device, comprising:
the monitoring unit is used for monitoring the fault of the grid instance of the service grid port which is called by the service priority;
and the switching unit is used for switching the micro service port to be in an available state and the service grid port to be in an unavailable state if the grid instance of the service grid port is monitored to have a fault.
10. A service port switching device, comprising:
the response module is used for responding to the control message of the service port switched to the available state;
the execution module is used for executing the service port switching action of switching to the available state according to the metadata identification bit; the metadata identification bits mark service mesh ports or microservice ports.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the method of any one of claims 1 to 5, or 6 to 8, are implemented when the computer program is executed by the processor.
12. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5, or 6 to 8.
CN202210187552.2A 2022-02-28 2022-02-28 Service port switching method and device Pending CN114465878A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210187552.2A CN114465878A (en) 2022-02-28 2022-02-28 Service port switching method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210187552.2A CN114465878A (en) 2022-02-28 2022-02-28 Service port switching method and device

Publications (1)

Publication Number Publication Date
CN114465878A true CN114465878A (en) 2022-05-10

Family

ID=81414954

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210187552.2A Pending CN114465878A (en) 2022-02-28 2022-02-28 Service port switching method and device

Country Status (1)

Country Link
CN (1) CN114465878A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109743197A (en) * 2018-12-24 2019-05-10 中信百信银行股份有限公司 A kind of firewall deployment system and method based on priority configuration
CN112543143A (en) * 2020-11-30 2021-03-23 盛科网络(苏州)有限公司 Method, chip, equipment and storage medium for multicast service fast protection switching
CN113709707A (en) * 2021-10-29 2021-11-26 中兴通讯股份有限公司 Method and device for sidecar deployment in service grid, electronic equipment and storage medium
CN114024826A (en) * 2022-01-05 2022-02-08 苏州博纳讯动软件有限公司 Application multi-active system based on service grid technology and used in distributed ESB scene

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109743197A (en) * 2018-12-24 2019-05-10 中信百信银行股份有限公司 A kind of firewall deployment system and method based on priority configuration
CN112543143A (en) * 2020-11-30 2021-03-23 盛科网络(苏州)有限公司 Method, chip, equipment and storage medium for multicast service fast protection switching
CN113709707A (en) * 2021-10-29 2021-11-26 中兴通讯股份有限公司 Method and device for sidecar deployment in service grid, electronic equipment and storage medium
CN114024826A (en) * 2022-01-05 2022-02-08 苏州博纳讯动软件有限公司 Application multi-active system based on service grid technology and used in distributed ESB scene

Similar Documents

Publication Publication Date Title
US20200042365A1 (en) Service Bus for Telecom Infrastructure
CN106664216B (en) VNF switching method and device
US9350682B1 (en) Compute instance migrations across availability zones of a provider network
CN110990047A (en) Fusion method and device for multiple microservice architectures
CN112055422B (en) Method and device for associating 5G signaling with user plane data
CN111064626B (en) Configuration updating method, device, server and readable storage medium
CN113765816A (en) Flow control method, system, equipment and medium based on service grid
CN113839814A (en) Decentralized Kubernetes cluster federal implementation method and system
CN111884844A (en) Message service access method and device based on zookeeper
CN112019614B (en) Method, system and processor for communication and communication synchronization between two systems
CN114465878A (en) Service port switching method and device
CN116095145B (en) Data control method and system of VPC cluster
CN111614702B (en) Edge calculation method and edge calculation system
CN115834668B (en) Cluster node control method, device, equipment, storage medium and program product
CN114615320B (en) Service management method, device, electronic equipment and computer readable storage medium
CN115391058B (en) SDN-based resource event processing method, resource creation method and system
CN113407382B (en) Dynamic regulation and control method and system for service fault
CN114726724B (en) Intent-based networking using network change verification
CN115065686A (en) Configuration method, device and system of distributed load balancing system
US20210067402A1 (en) Disaster Recovery of Cloud Resources
CN114461424A (en) Inter-unit service discovery method, device and system under unitized deployment architecture
CN114390059B (en) Service processing system and service processing method
JP6315467B2 (en) Network recovery system and program
CN111355988B (en) Business disaster recovery method, equipment and readable storage medium
US20230067181A1 (en) Communication device and communication method

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