CN117459444A - Method, device and storage medium for micro-service co-city dual-activity concentric priority routing - Google Patents

Method, device and storage medium for micro-service co-city dual-activity concentric priority routing Download PDF

Info

Publication number
CN117459444A
CN117459444A CN202311462857.0A CN202311462857A CN117459444A CN 117459444 A CN117459444 A CN 117459444A CN 202311462857 A CN202311462857 A CN 202311462857A CN 117459444 A CN117459444 A CN 117459444A
Authority
CN
China
Prior art keywords
service
nacos
routing
cluster
center
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
CN202311462857.0A
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.)
Yiqiyin Hangzhou Technology Co ltd
Original Assignee
Yiqiyin Hangzhou Technology 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 Yiqiyin Hangzhou Technology Co ltd filed Critical Yiqiyin Hangzhou Technology Co ltd
Priority to CN202311462857.0A priority Critical patent/CN117459444A/en
Publication of CN117459444A publication Critical patent/CN117459444A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • H04L45/04Interdomain routing, e.g. hierarchical routing
    • 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
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/1066Session management
    • H04L65/1073Registration or de-registration

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Multimedia (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a method, equipment and a storage medium for double-activity concentric priority routing of a micro service in the same city based on Dubbo and Nacos, wherein a set of Nacos routing cluster and Nacos registry cluster are respectively deployed in two data centers in the same city; configuring a data center identifier by the Nacos routing cluster, and storing a marker for marking whether a priority routing function of the same data center is started in a local memory of each node of the Nacos routing cluster; according to the invention, the Nacos routing cluster is deployed before the Nacos registration center cluster, the flow message when Dubo communicates with the Nacos registration center is intercepted and processed, and whether the service instance information of the same center or the service instance information of another data center should be returned is automatically judged.

Description

Method, device and storage medium for micro-service co-city dual-activity concentric priority routing
Technical Field
The invention relates to the technical field of micro services, in particular to a method, equipment and storage medium for dual-activity concentric priority routing of a micro service same city based on Dubbo and Nacos.
Background
Micro-service is a software development technology, divides a single application program into a group of small services to coordinate with each other, and is an important supporting technology for supporting large-scale application service at present. And the automatic service registration, service discovery, load balancing, remote procedure call and the like for realizing the micro-service based on the open source software Dubbo and Nacos are the technical proposal commonly used at present. Since the micro-services mainly bear real-time transaction type services, the micro-service platform has a great influence on the usability of the system and the continuity of the services. The same-city double-activity technology of the micro service is an important basic technology for improving the usability of the whole micro service system, two data centers are deployed in one city through the same-city double-activity technology, a service system is deployed to the two data centers simultaneously for external service, the system can be improved to the disaster tolerance degree of a machine room level, and the reliability of the service system is greatly improved. In the deployment mode of the same city double centers, when one service calls the downstream service, the service route can have the alternative of being deployed in the same data center and the other data center, and the service call crossing the machine room is slightly longer than the machine room due to the problem of physical distance on the service call delay, so that the service reliability is improved, the calling performance is considered, the mode of supporting the same center priority route in the service route, namely, the service instance of the same data center is preferentially selected for calling, and when the same center does not have the available service instance, the service call crossing the center is carried out.
Currently, when Dubbo and Nacos are used as service call modules of micro services, the implementation mechanism of the open source community version is as follows: a set of Nacos registries are deployed at each of the two data centers, and the service provider registers services only on the Nacos registries of the same data center. The consumer of the service subscribes to the service information of two data centers at the same time and keeps updating the service instance information in real time, the consumer of the service needs to transmit a cluster identifier when starting, which data center the current service instance is in, when the service call is carried out, the consumer of the service preferentially inquires the service instance in the Nacos registration center of the same center, when the available instance exists, one service instance is selected for call, when the available instance does not exist, the service instance of the Nacos registration center of the non-same center is inquired, one service instance is selected for call, and the concentric preferential route when the micro service call is realized in the mode. The technology of the micro-service concentric priority routing of the open source Dubbo and Nacos communities has the defects of large application development quantity, large test quantity and high deployment and maintenance cost. Because the service routing logic of each service project needs to be modified in the mode, project codes of all existing services need to be modified, and when a large-scale micro-service cluster is formed in an enterprise, all project groups are driven to modify the service projects maintained respectively under the service scale of hundreds to thousands, and testing is carried out, great labor cost and management cost are required to be input for deployment and online, the time is long, the effect is slow, and the production and operation risks are high.
Disclosure of Invention
The invention aims to solve the technical problems, and provides a method, equipment and a storage medium for dual-active concentric priority routing of a micro service in the same city based on Dubbo and Nacos.
The invention aims at realizing the following technical scheme:
in a first aspect, the present invention provides a method for preferentially routing dual activities in the same city of micro services, including:
a set of Nacos routing clusters and Nacos registry clusters are respectively deployed in two data centers in the same city; the Nacos routing cluster is positioned at the front end of the Nacos registration center cluster; each data center is also provided with a domain name server and a configuration server, wherein the domain name server configures the mapping relation between the domain name of the Nacos route cluster and the corresponding IP address;
the Nacos routing cluster is provided with a data center identifier, which is used for identifying the data center where the Nacos routing cluster is located, and a marker for marking whether a priority routing function of the same data center is started or not is stored in a local memory of each node of the Nacos routing cluster;
the method comprises the steps that based on Dubbo and Nacos, the domain name of a Nacos routing cluster configured by a user node is required to be read in service registration and service discovery, a domain name resolution request is initiated to a domain name server, the IP address of the Nacos routing cluster concentric with the user node is obtained, and the request is initiated to the IP address;
the Nacos routing cluster intercepts all traffic accessing the Nacos registry cluster and processes the traffic as follows:
step 1: after receiving service request data, the Nacos routing cluster judges whether the prior routing function of the current same data center is started, if so, the request is directly forwarded to the Nacos registration center cluster of the same center, otherwise, the step 2 is entered;
step 2: judging whether the current request is a service registration request or a service discovery request, if the current request is the service registration request, directly forwarding the request to a Nacos registration center cluster of the same center, otherwise, entering a step 3;
step 3: analyzing interface data in the service discovery request, judging whether the service discovery request belongs to the Dubbo service discovery request, if not, directly forwarding the request to a Nacos registry cluster at the same center, and if so, entering step 4;
step 4: forwarding the Dubbo service discovery request to a Nacos registry cluster of the same data center, analyzing the returned message, judging whether available and healthy service examples exist or not, and if so, directly returning the message to the requested consumer service; if not, inquiring whether the priority routing function of the same data center in the local memory is on or not, if so, directly returning the message to the requested consumer service, otherwise, entering step 5;
step 5: reading the data center identifier, forwarding the request to a Nacos registration center cluster of another data center according to the data center cross-center where the data center is currently located, and returning the received message to the consumer service of the request.
Further, applying for a domain name for the Nacos routing cluster, and configuring a mapping relation between the domain name and a corresponding IP address in a domain name server of each data center, wherein the mapping relation is the IP address of the concentric Nacos routing cluster.
Further, configuring domain names of Nacos routing clusters of the data centers to which the user nodes belong, and accessing the Nacos registry through the domain names.
Further, the service registration specifically includes:
based on the Dubbo service registration mechanism, a service provider reads the domain name of a configured Nacos routing cluster after a micro service engineering is started, and initiates a domain name resolution request to a domain name server;
the domain name server returns the IP address of the Nacos routing cluster which is positioned in the same data center with the service provider according to a preset mapping rule;
the service provider initiates a network request to the IP address, registers registration information to a Nacos registration center, maintains the registration information by a mechanism for timing network heartbeat, considers that the node fails when a heartbeat message is not received in a set heartbeat period, and downloads the node information from the Nacos registration center.
Further, the service discovery is specifically:
based on the Dubbo service discovery mechanism, a service consumer reads the domain name of a configured Nacos routing cluster after a micro service engineering is started, and initiates a domain name resolution request to a domain name server;
the domain name server returns the IP address of the Nacos routing cluster which is positioned in the same data center with the service consumer according to a preset mapping rule;
the service consumer initiates a network request to the IP address, queries registration information of a service provider in a Nacos registration center in a set time period, and synchronizes the registration information to a memory cache of a local process, wherein the local memory cache data is kept synchronous with the data of the Nacos registration center.
Further, when a service call occurs, the service consumer queries the service registration data in the local memory based on the Dubbo's load balancing mechanism, selects a service provider instance through a specified load balancing algorithm, and initiates a remote procedure call.
Further, after receiving the service discovery message, the service consumer updates the service provider information into the local memory cache, the local cache data is refreshed in real time, and when the service instance is not available in the same center, the service consumer updates the service information of another data center; when the service instance of the same center is recovered, the service instance is updated to the service information of the same data center.
Further, the configuration dynamic refreshing of whether the priority routing function of the same data center is started is specifically:
the Nacos routing cluster is externally hung with a configuration service, and a configuration whether a switch with a priority routing function of a data center is opened or not is maintained in each node memory of the Nacos routing cluster;
based on the release monitoring mechanism, when configuration is modified in the configuration service, all nodes of the Nacos routing cluster are notified in real time, each node of the Nacos routing cluster refreshes the configuration to a local memory cache, and configuration data is stored in a local disk at the same time;
the nodes of the Nacos route cluster are used for comparing the data cached in the local memory with the data in the configuration service at regular time, and when the data are inconsistent, the data of the configuration service are used as the standard to cover the local cache; in the extreme case that peripheral configuration is not available, if the node of the Nacos routing cluster is restarted, the configuration data in the local disk is loaded, so that the situation that the Nacos routing cluster cannot be started due to the fact that configuration service is not available is avoided.
In a second aspect, the present invention provides a micro-service co-city dual-active co-center preferential routing device, including a memory and one or more processors, where the memory stores executable code, and the processors implement the micro-service co-city dual-active co-center preferential routing method according to the first aspect when executing the executable code.
In a third aspect, the present invention provides a computer readable storage medium having stored thereon a program which, when executed by a processor, implements a micro-service co-city dual-active co-centric preferential routing method according to the first aspect.
The beneficial effects of the invention are as follows: according to the invention, the Nacos routing cluster is deployed before the Nacos registration center cluster, the flow message when Dubo communicates with the Nacos registration center is intercepted and processed, and whether the service instance information of the same center or the service instance information of another data center should be returned is automatically judged.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a diagram of a micro-service co-city dual-active co-centric preferential routing method architecture shown in an exemplary embodiment;
fig. 2 is a block diagram of a micro-service co-city dual-active co-centric priority routing device shown in an exemplary embodiment.
Detailed Description
In order that the above objects, features and advantages of the invention will be readily understood, a more particular description of the invention will be rendered by reference to the appended drawings.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, but the present invention may be practiced in other ways other than those described herein, and persons skilled in the art will readily appreciate that the present invention is not limited to the specific embodiments disclosed below.
As shown in fig. 1, the present invention provides a method for preferential routing of dual activities in the same city, i.e., two data centers in the same city, denoted as data center 1 and data center 2, of a micro service based on Dubbo and Nacos.
Each data center is provided with a set of Nacos routing cluster and a Nacos registration center cluster; the Nacos routing cluster is located at the front end of the Nacos registry cluster. Each data center also has a domain name server and a configuration server. Applying a domain name for the Nacos routing clusters, and configuring a mapping relation between the domain name and a corresponding IP address in a domain name server of each data center, wherein the mapping relation is the IP address of the concentric Nacos routing clusters, namely configuring the IP address of the domain name mapped to the Nacos routing clusters in the data center 1 in the domain name server of the data center 1, and configuring the IP address of the domain name mapped to the Nacos routing clusters in the data center 2 in the domain name server of the data center 2.
A data center identifier is configured for the Nacos routing cluster to identify which data center the cluster is in. A marker is stored in the local memory of each node of the Nacos routing cluster to mark whether the priority routing function with the data center is on, in this embodiment TRUE indicates on and FALSE indicates off.
The subscribers in this embodiment include service providers and service consumers who configure the domain name of the Nacos routing cluster of the data center to which they belong at the subscriber node, and subsequently access the Nacos registry through that domain name.
Service registration, service discovery, load balancing, remote procedure call and the like of the micro service are realized based on open source software Dubbo and Nacos. The Nacos registry is the core infrastructure for microservice registration discovery.
Service registration, specifically: based on the Dubbo service registration mechanism, a service provider reads the domain name of a configured Nacos routing cluster after a micro service engineering is started, and initiates a domain name resolution request to a domain name server. The domain name server returns the IP address of the Nacos route cluster, and according to a pre-configured mapping rule, the domain name server returns the IP address of the Nacos route cluster which is positioned in the same data center with the service provider, the service provider initiates a network request to the IP address, registers own service interface information, communication information of a node and other registration information to the Nacos registration center, maintains the registration information by a mechanism for timing network heartbeat, and considers the node to be invalid and downloads the node information from the Nacos registration center when a heartbeat message is not received in excess of a certain heartbeat period.
Service discovery specifically includes: based on the Dubbo service discovery mechanism, a service consumer reads the domain name of a configured Nacos routing cluster after a micro service engineering is started, and initiates a domain name resolution request to a domain name server. The domain name server returns the IP address of the Nacos routing cluster, and according to a pre-configured mapping rule, the domain name server returns the IP address of the Nacos routing cluster which is positioned in the same data center as the service consumer, the service consumer initiates a network request to the IP address, the registration information of the service provider is queried in the Nacos registration center in a certain time period and is synchronized to the memory cache of the local process, and the data of the local memory cache is kept synchronous with the data of the Nacos registration center.
Service routing, specifically: when service call occurs, service consumer queries service registration data in local memory based on Dubbo's load balancing mechanism, selects a service provider instance through specified load balancing algorithm, and initiates remote procedure call.
The Nacos routing cluster intercepts all traffic that accesses the Nacos registry cluster, and the processing logic of the traffic for a particular traffic request is as follows:
step 1: after receiving the service request data, the Nacos routing cluster judges whether a switch of a prior routing function of the same data center is on or not, if the switch is in a closed state, the request is directly forwarded to the Nacos registration center cluster of the same center, otherwise, the step 2 is carried out.
Step 2: and judging whether the current request is a service registration request or a service discovery request, if the current request is the service registration request, directly forwarding the request to a Nacos registration center cluster of the same center, and if the current request is the service discovery request, entering the following step 3.
Step 3: and for the service discovery request, analyzing interface data in the request, judging whether the service discovery request belongs to the Dubbo service discovery request, if the service discovery request is a non-Dubbo service discovery request, directly forwarding the request to a Nacos registry cluster at the same center, and if the service discovery request is the Dubbo service discovery request, entering the following step 4.
Step 4: for the service discovery request of Dubbo, the request is forwarded to a Nacos registry cluster of the same data center, the returned data message is analyzed, whether the returned message has available and healthy service examples is judged, and if the available and healthy service examples exist, the message is directly returned to the requested consumer service. If no service instance is available, inquiring whether the priority routing function of the same data center in the local memory is started or not, if so, directly returning the message to the requesting consumer service, and if so, entering the following step 5.
The pseudocode for determining whether there are available service instances is as follows:
hosts=response.get("hosts");
length=hosts.length
for(i=0;i<length;i++){
host=hosts[i];
healthy=host.get("healthy");
enabled=host.get("enabled");
if(healthy&&enabled){
return true;
}
}
step 5: reading the data center identifier, forwarding the request to a Nacos registration center cluster of another data center according to the data center cross-center where the data center is currently located, and returning the received message to the consumer service of the request.
Step 6: after receiving the service discovery message, the service consumer updates the service provider information into the local memory cache, so that the local cache data is refreshed in real time, and when the service instance is not available in the same center, the service consumer updates the service information of another data center. When the service instance of the same center is restored, the service instance of the same center is updated to the service information of the same data center.
Specifically, the configuration of whether the priority routing function switch of the same data center is on is dynamically refreshed. Because the Nacos routing cluster is a high-traffic service, application start-up and shut-down can affect the registration discovery function of each micro service instance, the configuration needs to support dynamic refresh at runtime after configuration modification without re-application. The implementation mode is as follows: the Nacos routing cluster is externally hung with a configuration service, a configuration whether the switch is opened or not is maintained in each node memory of the Nacos routing cluster, all nodes of the Nacos routing cluster are informed in real time when the configuration is modified by the configuration service based on a release monitoring mechanism, the nodes of the Nacos routing cluster refresh the configuration to a local memory cache, and meanwhile, a part of configuration data is stored in a local disk. The nodes of the Nacos routing cluster can compare the data cached in the local memory with the data in the configuration service at regular time, and when the data is inconsistent, the data of the configuration service is used as the standard to cover the local cache. Under the extreme condition that peripheral configuration is unavailable, the nodes of the Nacos routing cluster are restarted, and when no memory cache data exists, the configuration data in the local disk are loaded, so that the high availability of the configuration data is ensured.
The invention intercepts and processes all access traffic by designing the Nacos route cluster, does not invade service engineering codes and open-source Nacos and Dubbo codes, has small influence and is transparent to service engineering and Nacos clusters. Because the service engineering codes of all the micro services do not need to be modified by organizing manpower, particularly under the technical background of large-scale micro service clusters, a large amount of development, test and maintenance manpower can be saved, and the implementation time of the whole project can be shortened.
The invention also provides an embodiment of the micro-service co-city dual-activity concentric priority routing device corresponding to the embodiment of the micro-service co-city dual-activity concentric priority routing method.
Referring to fig. 2, the micro-service co-city dual-activity concentric priority routing device provided by the embodiment of the invention includes a memory and one or more processors, where the memory stores executable codes, and the processors are configured to implement a micro-service co-city dual-activity concentric priority routing method in the above embodiment when executing the executable codes.
The embodiment of the micro-service co-city dual-activity concentric priority routing device provided by the invention can be applied to any device with data processing capability, and the any device with data processing capability can be a device or a device such as a computer. The device embodiments may be implemented by software, or may be implemented by hardware or a combination of hardware and software. Taking software implementation as an example, the device in a logic sense is formed by reading corresponding computer program instructions in a nonvolatile memory into a memory through a processor of any device with data processing capability. From the hardware level, as shown in fig. 2, a hardware structure diagram of an arbitrary device with data processing capability where a micro service co-city dual-activity concentric priority routing device provided by the present invention is located is shown in fig. 2, except for a processor, a memory, a network interface, and a nonvolatile memory shown in fig. 2, where the arbitrary device with data processing capability where the device is located in an embodiment generally includes other hardware according to an actual function of the arbitrary device with data processing capability, which is not described herein again.
The implementation process of the functions and roles of each unit in the above-mentioned device is specifically detailed in the implementation process of the corresponding steps in the above-mentioned method, and will not be described herein again.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The above described embodiments of the apparatus are only illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present invention. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The embodiment of the invention also provides a computer readable storage medium, wherein a program is stored on the computer readable storage medium, and when the program is executed by a processor, the method for the dual-active concentric preferential routing of the micro-service in the embodiment is realized.
The computer readable storage medium may be an internal storage unit, such as a hard disk or a memory, of any of the data processing enabled devices described in any of the previous embodiments. The computer readable storage medium may be any external storage device that has data processing capability, such as a plug-in hard disk, a Smart Media Card (SMC), an SD Card, a Flash memory Card (Flash Card), or the like, which are provided on the device. Further, the computer readable storage medium may include both internal storage units and external storage devices of any data processing device. The computer readable storage medium is used for storing the computer program and other programs and data required by the arbitrary data processing apparatus, and may also be used for temporarily storing data that has been output or is to be output.
The above-described embodiments are intended to illustrate the present invention, not to limit it, and any modifications and variations made thereto are within the spirit of the invention and the scope of the appended claims.

Claims (10)

1. A method for dual active concentric preferential routing of micro services in the same city, comprising:
a set of Nacos routing clusters and Nacos registry clusters are respectively deployed in two data centers in the same city; the Nacos routing cluster is positioned at the front end of the Nacos registration center cluster; each data center is also provided with a domain name server and a configuration server, wherein the domain name server configures the mapping relation between the domain name of the Nacos route cluster and the corresponding IP address;
the Nacos routing cluster is provided with a data center identifier, which is used for identifying the data center where the Nacos routing cluster is located, and a marker for marking whether a priority routing function of the same data center is started or not is stored in a local memory of each node of the Nacos routing cluster;
the method comprises the steps that based on Dubbo and Nacos, the domain name of a Nacos routing cluster configured by a user node is required to be read in service registration and service discovery, a domain name resolution request is initiated to a domain name server, the IP address of the Nacos routing cluster concentric with the user node is obtained, and the request is initiated to the IP address;
the Nacos routing cluster intercepts all traffic accessing the Nacos registry cluster and processes the traffic as follows:
step 1: after receiving service request data, the Nacos routing cluster judges whether the prior routing function of the current same data center is started, if so, the request is directly forwarded to the Nacos registration center cluster of the same center, otherwise, the step 2 is entered;
step 2: judging whether the current request is a service registration request or a service discovery request, if the current request is the service registration request, directly forwarding the request to a Nacos registration center cluster of the same center, otherwise, entering a step 3;
step 3: analyzing interface data in the service discovery request, judging whether the service discovery request belongs to the Dubbo service discovery request, if not, directly forwarding the request to a Nacos registry cluster at the same center, and if so, entering step 4;
step 4: forwarding the Dubbo service discovery request to a Nacos registry cluster of the same data center, analyzing the returned message, judging whether available and healthy service examples exist or not, and if so, directly returning the message to the requested consumer service; if not, inquiring whether the priority routing function of the same data center in the local memory is on or not, if so, directly returning the message to the requested consumer service, otherwise, entering step 5;
step 5: reading the data center identifier, forwarding the request to a Nacos registration center cluster of another data center according to the data center cross-center where the data center is currently located, and returning the received message to the consumer service of the request.
2. The method for dual-active concentric preferential routing of a micro-service co-city according to claim 1, wherein a domain name is applied for a Nacos routing cluster, and a mapping relation between the domain name and a corresponding IP address is configured in a domain name server of each data center, wherein the mapping relation is the IP address of the Nacos routing cluster at the same center.
3. The method for dual-active concentric priority routing of a micro-service co-city according to claim 1, wherein the domain name of the Nacos routing cluster of the data center to which the user node belongs is configured, and access of the Nacos registry is achieved through the domain name.
4. The micro service co-city dual-activity concentric priority routing method of claim 1, wherein the service registration is specifically:
based on the Dubbo service registration mechanism, a service provider reads the domain name of a configured Nacos routing cluster after a micro service engineering is started, and initiates a domain name resolution request to a domain name server;
the domain name server returns the IP address of the Nacos routing cluster which is positioned in the same data center with the service provider according to a preset mapping rule;
the service provider initiates a network request to the IP address, registers registration information to a Nacos registration center, maintains the registration information by a mechanism for timing network heartbeat, considers that the node fails when a heartbeat message is not received in a set heartbeat period, and downloads the node information from the Nacos registration center.
5. The micro-service co-city dual-activity concentric priority routing method of claim 1, wherein the service discovery is specifically:
based on the Dubbo service discovery mechanism, a service consumer reads the domain name of a configured Nacos routing cluster after a micro service engineering is started, and initiates a domain name resolution request to a domain name server;
the domain name server returns the IP address of the Nacos routing cluster which is positioned in the same data center with the service consumer according to a preset mapping rule;
the service consumer initiates a network request to the IP address, queries registration information of a service provider in a Nacos registration center in a set time period, and synchronizes the registration information to a memory cache of a local process, wherein the local memory cache data is kept synchronous with the data of the Nacos registration center.
6. The method for dual-active concentric preferential routing of micro-service co-city according to claim 1, wherein when service call occurs, service consumer queries service registration data in local memory based on Dubbo's load balancing mechanism, selects service provider instance through specified load balancing algorithm, and initiates remote procedure call.
7. The method for preferential routing of dual-active and concentric centers of micro-service according to claim 1, wherein after receiving the service discovery message, the service consumer updates the service provider information into the local memory cache, and the local cache data is refreshed in real time, and updates the service information into the service information of another data center when there is no service instance available in the concentric center; when the service instance of the same center is recovered, the service instance is updated to the service information of the same data center.
8. The method for preferential routing of dual activity and concentric centers of a micro service according to claim 1, wherein the dynamic refresh of the configuration of whether the preferential routing function of the concentric data center is on is specifically:
the Nacos routing cluster is externally hung with a configuration service, and a configuration whether a switch with a priority routing function of a data center is opened or not is maintained in each node memory of the Nacos routing cluster;
based on the release monitoring mechanism, when configuration is modified in the configuration service, all nodes of the Nacos routing cluster are notified in real time, each node of the Nacos routing cluster refreshes the configuration to a local memory cache, and configuration data is stored in a local disk at the same time;
the nodes of the Nacos route cluster are used for comparing the data cached in the local memory with the data in the configuration service at regular time, and when the data are inconsistent, the data of the configuration service are used as the standard to cover the local cache; in the extreme case that peripheral configuration is not available, if the node of the Nacos routing cluster is restarted, the configuration data in the local disk is loaded, so that the situation that the Nacos routing cluster cannot be started due to the fact that configuration service is not available is avoided.
9. A micro-service co-city dual-active co-centric preferential routing device comprising a memory and one or more processors, the memory having executable code stored therein, wherein the processor, when executing the executable code, implements the micro-service co-city dual-active co-centric preferential routing method of any one of claims 1-8.
10. A computer readable storage medium having stored thereon a program, wherein the program when executed by a processor implements the microservice co-city dual activity concentric priority routing of any of claims 1-8.
CN202311462857.0A 2023-11-06 2023-11-06 Method, device and storage medium for micro-service co-city dual-activity concentric priority routing Pending CN117459444A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311462857.0A CN117459444A (en) 2023-11-06 2023-11-06 Method, device and storage medium for micro-service co-city dual-activity concentric priority routing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311462857.0A CN117459444A (en) 2023-11-06 2023-11-06 Method, device and storage medium for micro-service co-city dual-activity concentric priority routing

Publications (1)

Publication Number Publication Date
CN117459444A true CN117459444A (en) 2024-01-26

Family

ID=89581500

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311462857.0A Pending CN117459444A (en) 2023-11-06 2023-11-06 Method, device and storage medium for micro-service co-city dual-activity concentric priority routing

Country Status (1)

Country Link
CN (1) CN117459444A (en)

Similar Documents

Publication Publication Date Title
CN106878376B (en) Configuration management method and system
CN106888233B (en) Data updating system and method
WO2017140131A1 (en) Data writing and reading method and apparatus, and cloud storage system
US9749445B2 (en) System and method for updating service information for across-domain messaging in a transactional middleware machine environment
CN110311837B (en) Online service availability detection method and device and computer equipment
CN110677462B (en) Access processing method, system, device and storage medium for multi-block chain network
CN111586121B (en) Distributed cloud mobile phone application installation method, cloud platform, system and storage medium
CN103607424A (en) Server connection method and server system
CN109783151B (en) Method and device for rule change
CN110601981A (en) Service routing method, service provider cloud domain and service calling cloud domain
CN113973129B (en) Gateway supporting multiple registry micro services
CN111064626B (en) Configuration updating method, device, server and readable storage medium
CN110781149A (en) Method, device, equipment and storage medium for managing live broadcast room information
CN111884844A (en) Message service access method and device based on zookeeper
CN106131102A (en) A kind of method and device of distribution server
CN109067564B (en) Distributed approach, device, computer equipment and storage medium
CN113900925A (en) Test environment building and utilizing method, device, equipment and storage medium
CN112559138A (en) Resource scheduling system and method
CN115190103A (en) Service grid-based service domain name resolution method, device and equipment
CN116647552A (en) Service processing method and system in heterogeneous micro-service cluster, terminal and storage medium
CN110730197B (en) Service discovery method and system
CN117459444A (en) Method, device and storage medium for micro-service co-city dual-activity concentric priority routing
CN112491943A (en) Data request method, device, storage medium and electronic equipment
CN116260878A (en) Service center system based on global service structure server of distributed computing and storage
CN112702441B (en) Container-based access data processing method, device, system and storage medium

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