Disclosure of Invention
The invention provides a gray level release method device based on a micro-service architecture and electronic equipment, and mainly aims to solve the problems that the operation and maintenance cost is high and gray level user groups cannot be flexibly configured when gray level release is realized through an Nginx load balancing algorithm at present.
In order to achieve the above object, the present invention provides a gray level publishing method based on a micro-service architecture, comprising:
designating an initial gray scale service and a gray scale front end of gray scale release according to a preset gray scale release plan, and configuring a gray scale release version by utilizing the initial gray scale service and the gray scale front end;
acquiring configuration information of a gray level front end, and designating a service object of gray level release according to the configuration information of the gray level front end to obtain a gray level object list;
registering the initial gray scale service into Nacos to obtain a target gray scale service, acquiring a configuration file of the Nacos, and designating a gray scale version number of the target gray scale service by using the configuration file of the Nacos;
the obtaining the configuration file of the Nacos, and designating the gray scale version number of the target gray scale service by using the configuration file of the Nacos comprises the following steps:
receiving a configuration file acquisition instruction, and constructing a secure connection with a pre-constructed Nacos configuration service;
extracting identification information of a target gray scale service from the configuration file acquisition instruction, and acquiring a configuration file of Nacos according to the identification information;
analyzing the configuration file of the Nacos to obtain configuration information related to the target gray scale service;
identifying a gray scale version number of the target gray scale service from the configuration information;
Acquiring configuration information and local routing rules of a target gray scale service, configuring version routing rules by using the configuration information and gray scale version number of the target gray scale service, and dynamically and synchronously updating the local routing rules according to the version routing rules to obtain gateway routing rules;
based on Spring Cloud Gateway gateway receiving operation request, obtaining front end resource information of the operation request, screening the operation request according to the front end resource information of the operation request and the gray object list, and obtaining gray request;
the method comprises the steps of obtaining version information of a gray request, routing the gray request to a target gray service according to the version information of the gray request and a gateway routing rule in a gray release version, and operating the target gray service to obtain gray request feedback, wherein the target gray service is identical to a gray version number and a URL path of the gray request;
and feeding back and adjusting the target gray scale service according to the gray scale request, updating a gray scale object list, and finishing gray scale release based on a micro-service architecture.
Optionally, the configuring the gray scale release version by using the initial gray scale service and the gray scale front end includes:
creating an initial gray scale environment, and introducing the initial gray scale service and the gray scale front end into the initial gray scale environment to obtain a target gray scale environment;
And putting the target gray environment into a pre-constructed service platform to obtain a gray release version.
Optionally, the service object of the gray level release is specified according to the configuration information of the gray level front end, and a gray level object list is obtained, including:
extracting the IP address of the gray level front end from the configuration information of the gray level front end to obtain a target gray level IP address;
acquiring a service object with the target gray IP address, and designating the service object as a gray object;
and summarizing the gray objects to obtain a gray object list.
Optionally, registering the initial gray scale service in the Nacos to obtain the target gray scale service includes:
acquiring service information of an initial gray scale service, creating an initial Servicelnstance instance, and configuring the service information of the initial gray scale service in the initial Servicelnstance instance to obtain a target Servicelnstance instance;
adding a Nacos Client SDK, and initializing Nacos configuration by using the Nacos Client SDK to obtain initial Nacos configuration;
the initial Nacos are utilized to configure a port of the designated Nacos, and a gray service registration port is obtained;
calling a registerlnstance method preset in a Nacos Client SDK according to a target Servicelstance instance, and registering an initial gray service in the Nacos by using the registerlnstance method and a gray service registration port to obtain a target gray service.
Optionally, the configuring the version routing rule by using the configuration information and the gray version number of the target gray service dynamically and synchronously updates the local routing rule according to the version routing rule to obtain a gateway routing rule, which includes:
extracting a gray scale version number and a URL path of the target gray scale service from the configuration information of the target gray scale service;
creating a route configuration space according to the gray version number of the target gray service and the URL path, and setting the gray version number as an interface of the route configuration space;
in the routing configuration space, matching the target gray scale service with the same gray scale version number and URL path with the interface of the routing configuration space to obtain a version routing rule for routing the target gray scale service by using the gray scale version number and the URL path;
and synchronously updating the version routing rule into the local routing rule by using Nacos to obtain a gateway routing rule.
Optionally the Spring Cloud Gateway-based gateway receiving an operation request includes:
acquiring a Maven configuration file, and adding a Spring Cloud Gateway gateway and corresponding dependency items of a pre-constructed Netty framework into the Maven configuration file to obtain Netty dependency;
And creating HTTP by taking the Netty framework as a bottom layer, monitoring and receiving an operation request by utilizing the HTTP based on Netty dependence.
Optionally, the step of screening the operation request according to the front-end resource information of the operation request and the gray object list to obtain a gray request includes:
extracting the IP address of the operation request from the front-end resource information of the operation request;
acquiring configuration information of a gray object list, and extracting an IP address of the gray object list from the configuration information of an initial gray user list;
and extracting the operation request which is the same as the IP address of the gray object list from the operation request according to the IP address of the gray object list and the IP address of the operation request to obtain the gray request.
Optionally, the routing the gray request to the target gray service according to the version information of the gray request and the gateway routing rule, and operating the target gray service to obtain the gray request feedback, including:
creating Gateway configuration classes, and configuring Gateway routing rules into the Spring Cloud Gateway Gateway by using the Gateway configuration classes to obtain target routing rules;
extracting a version number and a URL path of the gray request from the version information of the gray request, and taking the version number of the gray request as a request interface of the Spring Cloud Gateway gateway;
Matching target gray scale service with the same gray scale version number and the same URL path with gray scale request according to a request interface and a target routing rule of the Spring Cloud Gateway gateway;
according to the target routing rule, utilizing a Spring Cloud Gateway gateway to route the gray request to the target gray service;
and operating the target gray service according to the gray request to obtain gray request feedback.
Optionally, the adjusting the target gray scale service according to the gray scale request feedback, updating a gray scale object list, and completing gray scale release based on a micro service architecture includes:
judging whether the target gray service with the same gray version number and the same URL path as the gray request is available service or not according to gray service feedback by utilizing Nacos;
if the target gray scale service is not available service, adjusting the target gray scale service by using Nacos, returning to the step of using Nacos, and judging whether the target gray scale service with the same gray scale version number and the same URL path as the gray scale request is available service according to gray scale service feedback;
if the target gray scale service is available service, acquiring a configuration file of a gray scale object list, and expanding a service object of the target gray scale service by using the configuration file of the gray scale object list to obtain a service user list;
And expanding the range of gray release versions according to the service user list, and realizing gray release based on the micro-service architecture.
In order to solve the above problems, the present invention further provides a gray scale publishing device based on a micro service architecture, the device comprising:
the gray release version configuration module is used for designating an initial gray service and a gray front end of gray release according to a preset gray release plan and configuring a gray release version by utilizing the initial gray service and the gray front end; acquiring configuration information of a gray level front end, and designating a service object of gray level release according to the configuration information of the gray level front end to obtain a gray level object list; registering the initial gray scale service into Nacos to obtain a target gray scale service, acquiring a configuration file of the Nacos, and designating a gray scale version number of the target gray scale service by using the configuration file of the Nacos; the obtaining the configuration file of the Nacos, and designating the gray scale version number of the target gray scale service by using the configuration file of the Nacos comprises the following steps: receiving a configuration file acquisition instruction, and constructing a secure connection with a pre-constructed Nacos configuration service; extracting identification information of a target gray scale service from the configuration file acquisition instruction, and acquiring a configuration file of Nacos according to the identification information; analyzing the configuration file of the Nacos to obtain configuration information related to the target gray scale service; identifying a gray scale version number of the target gray scale service from the configuration information;
The gateway routing module is used for acquiring configuration information and local routing rules of the target gray scale service, configuring version routing rules by utilizing the configuration information and gray scale version number of the target gray scale service, and dynamically and synchronously updating the local routing rules according to the version routing rules to obtain gateway routing rules; based on Spring Cloud Gateway gateway receiving operation request, obtaining front end resource information of the operation request, screening the operation request according to the front end resource information of the operation request and the gray object list, and obtaining gray request; the method comprises the steps of obtaining version information of a gray request, routing the gray request to a target gray service according to the version information of the gray request and a gateway routing rule in a gray release version, and operating the target gray service to obtain gray request feedback, wherein the target gray service is identical to a gray version number and a URL path of the gray request;
and the gray release version release module is used for feeding back and adjusting the target gray service according to the gray request, updating the gray object list and completing gray release based on the micro service architecture.
In order to solve the above-mentioned problems, the present invention also provides an electronic apparatus including:
At least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to implement the micro-service architecture based gray scale distribution method described above.
Compared with the background art, the method comprises the following steps: according to the embodiment of the invention, an initial gray service, a gray front end and a gray object influenced by the gray release version are designated by configuring the gray release version, so that a gray object list is obtained by summarizing the gray object, a gray version number of a target gray service is designated by Nocas, a version routing rule is configured according to the gray version number of the gray service, a local routing rule is updated by Nacos, so as to obtain a gateway routing rule, an operation request of a client is received, a gray request is screened according to the gray object list, the gray request is routed by using a Spring Cloud Gateway gateway, the target gray service is operated, gray request feedback is obtained, the availability of the target gray service is judged according to the gray request feedback, the gray object list is updated, and gray release is realized. Therefore, the gray level release method, the gray level release device and the electronic equipment based on the micro-service architecture can solve the problems that the operation and maintenance cost is high and the gray level user group cannot be flexibly configured when gray level release is realized through the Nginx load balancing algorithm currently.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the application provides a gray level publishing method based on a micro-service architecture. The execution subject of the gray level publishing method based on the micro-service architecture includes, but is not limited to, at least one of a server, a terminal and the like, which can be configured to execute the method provided by the embodiment of the application. In other words, the gray scale distribution method based on the micro service architecture may be performed by software or hardware installed in a terminal device or a server device. The service end includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Example 1: referring to fig. 1, a flow chart of a gray level publishing method based on a micro-service architecture according to an embodiment of the invention is shown. In this embodiment, the gray level publishing method based on the micro service architecture includes:
s1, designating an initial gray scale service and a gray scale front end of gray scale release according to a preset gray scale release plan, and configuring a gray scale release version by utilizing the initial gray scale service and the gray scale front end.
The gray level release plan refers to a gray level release target and a new version service needing gray level release, and is exemplified by a set of service A for providing seven layers of services on line, at this time, some new service characteristics are developed, and a version service B containing the new service characteristics needs to be released.
In the embodiment of the invention, the initial gray service refers to a new version service needing gray release, and the gray front end refers to a front end resource of the new version service.
In the embodiment of the present invention, the configuration of the gray release version by using the initial gray service and the gray front end includes:
creating an initial gray scale environment, and introducing the initial gray scale service and the gray scale front end into the initial gray scale environment to obtain a target gray scale environment;
And putting the target gray environment into a pre-constructed service platform to obtain a gray release version.
The gray level release version is a service platform for gray level release, wherein the service platform is a centralized platform for providing services, is used for connecting the services and the service objects, and provides a series of functions and tools for managing and interacting with the services.
It can be explained that the target gray scale environment is a special environment between a development environment and a production environment for executing gray scale release, and new versions can be tested and verified step by step in order. In a greyscale environment, only a part of the users are guided to the new version, the other users still using the old version. The gray level release is carried out by using the gray level environment, so that the influence range of potential problems of the new version service can be limited, and the performance, stability and user experience of the new version service can be checked step by step.
It should be explained that the target gray scale environment has the same configuration and scale as the production environment and similar service environments.
S2, acquiring configuration information of the gray level front end, and designating a service object of gray level release according to the configuration information of the gray level front end to obtain a gray level object list.
The configuration information of the gray level front end includes an IP address of the gray level front end, where the IP address of the gray level front end refers to an IP address used by the client in network communication, and is used for identifying a user, performing geographic location positioning, and security verification, for example: public IP address of the user terminal equipment and private IP address in the local area network.
In the embodiment of the invention, the gray object list refers to a service object list of gray release meeting the condition.
In the embodiment of the present invention, the service object for gray release is specified according to the configuration information of the gray front end, and a gray object list is obtained, which includes:
extracting the IP address of the gray level front end from the configuration information of the gray level front end to obtain a target gray level IP address;
acquiring a service object with the target gray IP address, and designating the service object as a gray object;
and summarizing the gray objects to obtain a gray object list.
And S3, registering the initial gray service into Nacos to obtain a target gray service, acquiring a configuration file of the Nacos, and designating a gray version number of the target gray service by using the configuration file of the Nacos.
The Nacos refers to an open source distributed configuration management and service discovery platform that provides functionality for dynamic configuration management, service registration and discovery. Illustratively, the Nacos can dynamically acquire the configuration and update the routing rules synchronously.
In detail, the Nacos includes a Nacos registry, and can register own services through the Nacos registry and discover other services. Illustratively, the Nacos registers the initial grayscale service to the Nacos registry by calling the registerlnstance method in the Nacos Client SDK.
In the embodiment of the present invention, registering an initial gray scale service in a Nacos to obtain a target gray scale service includes:
acquiring service information of an initial gray scale service, creating an initial Servicelnstance instance, and configuring the service information of the initial gray scale service in the initial Servicelnstance instance to obtain a target Servicelnstance instance;
adding a Nacos Client SDK, and initializing Nacos configuration by using the Nacos Client SDK to obtain initial Nacos configuration;
the initial Nacos are utilized to configure a port of the designated Nacos, and a gray service registration port is obtained;
calling a registerlnstance method preset in a Nacos Client SDK according to a target Servicelstance instance, and registering an initial gray service in the Nacos by using the registerlnstance method and a gray service registration port to obtain a target gray service.
In the embodiment of the present invention, the specifying the gray scale version number of the target gray scale service by using the configuration file of the Nacos includes:
Extracting a gray level configuration item from the configuration file of the Nacos and designating the value of the gray level configuration item to obtain a target configuration value;
and matching the target gray scale service according to the target configuration value to obtain a gray scale version number.
The configuration information of the initial gray service includes service name, IP address, port and URL path.
The URL path is interpreted to mean that in a complete URL, the location or path of the resource to be accessed on the server, usually starts at the first forward slash behind the domain name and ends with a slash or extension of the resource.
The service instance is an object used for representing a service instance in the micro-service architecture, and the attribute of the service instance contains information of the service instance, and the service Host attribute of the service instance represents an IP address of the service instance, so that a client can access related services through the IP address.
The Nacos Client SDK is a Client development kit for Nacos, and is commonly used for communication and interaction with Nacos servers. Illustratively, the Nacos registers the grayscale service to the Nacos registry by calling the registerlnstance method in the Nacos Client SDK.
The gray scale configuration item refers to a configuration attribute for specifying a gray scale service version number, for example: designating the value of the gradation configuration item as 1, the version number of the gradation service is 1.
Optionally, the acquiring the configuration file of the Nacos, and designating the gray scale version number of the target gray scale service by using the configuration file of the Nacos may further include:
receiving a configuration file acquisition instruction, and constructing a secure connection with a pre-constructed Nacos configuration service;
extracting identification information of a target gray scale service from the configuration file acquisition instruction, and acquiring a configuration file of Nacos according to the identification information;
analyzing the configuration file of the Nacos to obtain configuration information related to the target gray scale service;
and identifying the gray scale version number of the target gray scale service from the configuration information.
S4, acquiring configuration information and local routing rules of the target gray scale service, configuring version routing rules by using the configuration information and gray scale version number of the target gray scale service, and dynamically and synchronously updating the local routing rules according to the version routing rules to obtain gateway routing rules.
The routing rule refers to a rule for determining a transmission path of a network packet, and specifies a routing path of the packet from a source address to a destination address, and the version routing rule matches a destination gray scale service of a gray scale request according to a service version number, for example.
In the embodiment of the present invention, the local routing rule refers to a rule defined in the Nacos, including a default rule, a subnet rule, and a source address rule, which are used for determining a forwarding path of a data packet. Illustratively, when no specific rule matches, the system processes according to the default rule and sends the data packet to the default gateway.
In the embodiment of the present invention, the configuring version routing rule by using the configuration information and the gray version number of the target gray service dynamically and synchronously updates the local routing rule according to the version routing rule to obtain a gateway routing rule, including:
extracting a gray scale version number and a URL path of the target gray scale service from the configuration information of the target gray scale service;
creating a routing configuration space according to the gray version number of the target gray service and the URL path, setting the gray version number as an interface of the routing configuration space, and matching the target gray service with the same gray version number and URL path with the interface of the routing configuration space in the routing configuration space to obtain a version routing rule for routing the target gray service by using the gray version number and the URL path;
and synchronously updating the version routing rule into the local routing rule by using Nacos to obtain a gateway routing rule.
S5, receiving an operation request based on the Spring Cloud Gateway gateway, acquiring front-end resource information of the operation request, and screening the operation request according to the front-end resource information of the operation request and the gray object list to obtain a gray request.
Spring Cloud is a framework for building and managing distributed systems, and is a common problem for developing and managing distributed applications. Illustratively, the external requests are routed and filtered using a Spring Cloud Gateway gateway to protect the security and stability of the internal micro-services. Wherein the Spring Cloud Gateway gateway refers to a lightweight, non-blocking, responsive API gateway.
In the embodiment of the invention, the operation request refers to a request that a client applies for obtaining a corresponding target gray scale service, and the front-end resource information of the operation request includes an IP address of the operation request.
In the embodiment of the invention, the gray request refers to a request for obtaining a corresponding target gray service from a client belonging to a gray object list.
In the embodiment of the present invention, the receiving, by the gateway based on Spring Cloud Gateway, an operation request includes:
acquiring a Maven configuration file, and adding a Spring Cloud Gateway gateway and corresponding dependency items of a pre-constructed Netty framework into the Maven configuration file to obtain Netty dependency;
And creating HTTP by taking the Netty framework as a bottom layer, monitoring and receiving an operation request by utilizing the HTTP based on Netty dependence.
The Maven is a construction tool for managing the dependency, compiling, testing and compressing tasks of the Java items, and the properties and the dependency of the service items are defined by a pon.xml configuration file of the Maven. Wherein the pon.xml configuration file refers to the project object model.
The Netty framework is an interpretable network application framework with value-open sources for rapidly developing high-performance network servers and clients.
In the embodiment of the invention, the Netty dependency refers to the correlation dependency between the Spring Cloud Gateway gateway and the Netty framework.
In the embodiment of the invention, the IP address of the operation request is extracted from the front-end resource information of the operation request;
acquiring configuration information of a gray object list, and extracting an IP address of the gray object list from the configuration information of an initial gray user list;
and extracting the operation request which is the same as the IP address of the gray object list from the operation request according to the IP address of the gray object list and the IP address of the operation request to obtain the gray request.
The configuration information of the gray scale user list may include an IP address of the gray scale object list.
S6, acquiring version information of the gray request, and in the gray release version, routing the gray request to the target gray service according to the version information of the gray request and a gateway routing rule, and operating the target gray service to obtain gray request feedback, wherein the gray request feedback is obtained by the target gray service, and the gray version number and the URL path of the gray request are the same.
The gray request version information includes gray request gray version number and URL path, and the gray request feedback is the result of running the target gray service same as the gray request gray version number and URL path.
In the embodiment of the present invention, in the gray release version, the method routes the gray request to the target gray service according to the version information of the gray request and the gateway routing rule, and operates the target gray service to obtain the gray request feedback, including:
creating Gateway configuration classes, and configuring Gateway routing rules into the Spring Cloud Gateway Gateway by using the Gateway configuration classes to obtain target routing rules;
extracting a version number and a URL path of the gray request from the version information of the gray request, and taking the version number of the gray request as a request interface of the Spring Cloud Gateway gateway;
Matching target gray scale service with the same gray scale version number and the same URI path with the gray scale request according to a request interface of the Spring Cloud Gateway gateway and a target routing rule;
according to the target routing rule, utilizing a Spring Cloud Gateway gateway to route the gray request to the target gray service;
and operating the target gray service according to the gray request to obtain gray request feedback.
And S7, adjusting target gray scale service according to the gray scale request feedback, updating a gray scale object list, and finishing gray scale release based on a micro-service architecture.
In the embodiment of the present invention, the adjusting the target gray scale service according to the gray scale request feedback, updating the gray scale object list, and completing the gray scale release based on the micro service architecture includes:
judging whether the target gray service with the same gray version number and the same URI path as the gray request is available service or not according to gray service feedback by utilizing Nacos;
if the target gray service is not available service, adjusting the target gray service by Nacos, and returning to the step of judging whether the target gray service with the same gray version number and the same URI path as the gray request is available service according to the gray service target;
If the target gray scale service is available service, acquiring a configuration file of a gray scale object list, and expanding a service object of the target gray scale service by using the configuration file of the gray scale object list to obtain a service user list;
and expanding the range of gray release versions according to the service user list, and realizing gray release based on the micro-service architecture.
Compared with the background art, the method comprises the following steps: according to the embodiment of the invention, an initial gray service, a gray front end and a gray object influenced by the gray release version are designated by configuring the gray release version, so that a gray object list is obtained by summarizing the gray object, a gray version number of a target gray service is designated by Nocas, a version routing rule is configured according to the gray version number of the gray service, a local routing rule is updated by Nacos, so as to obtain a gateway routing rule, an operation request of a client is received, a gray request is screened according to the gray object list, the gray request is routed by using a Spring Cloud Gateway gateway, the target gray service is operated, gray request feedback is obtained, the availability of the target gray service is judged according to the gray request feedback, the gray object list is updated, and gray release is realized. Therefore, the gray level release method, the gray level release device and the electronic equipment based on the micro-service architecture can solve the problems that the operation and maintenance cost is high and the gray level user group cannot be flexibly configured when gray level release is realized through the Nginx load balancing algorithm currently.
Example 2: fig. 2 is a functional block diagram of a gray scale distribution device based on a micro-service architecture according to an embodiment of the present invention.
The gray scale distribution device 100 based on the micro-service architecture can be installed in an electronic device. The gray scale distribution device 100 based on the micro-service architecture may include a gray scale distribution version configuration module 101, a gateway routing module 102, and a gray scale distribution version release module 103 according to the implemented functions. The module of the invention, which may also be referred to as a unit, refers to a series of computer program segments, which are stored in the memory of the electronic device, capable of being executed by the processor of the electronic device and of performing a fixed function.
The gray release version configuration module 101 is configured to designate an initial gray service and a gray front end of gray release according to a preset gray release plan, and configure a gray release version by using the initial gray service and the gray front end; acquiring configuration information of a gray level front end, and designating a service object of gray level release according to the configuration information of the gray level front end to obtain a gray level object list; registering the initial gray scale service into Nacos to obtain a target gray scale service, acquiring a configuration file of the Nacos, and designating a gray scale version number of the target gray scale service by using the configuration file of the Nacos; the obtaining the configuration file of the Nacos, and designating the gray scale version number of the target gray scale service by using the configuration file of the Nacos comprises the following steps: receiving a configuration file acquisition instruction, and constructing a secure connection with a pre-constructed Nacos configuration service; extracting identification information of a target gray scale service from the configuration file acquisition instruction, and acquiring a configuration file of Nacos according to the identification information; analyzing the configuration file of the Nacos to obtain configuration information related to the target gray scale service; identifying a gray scale version number of the target gray scale service from the configuration information;
The gateway routing module 102 is configured to obtain configuration information and a local routing rule of a target gray scale service, configure a version routing rule by using the configuration information and a gray scale version number of the target gray scale service, and dynamically and synchronously update the local routing rule according to the version routing rule to obtain a gateway routing rule; based on Spring Cloud Gateway gateway receiving operation request, obtaining front end resource information of the operation request, screening the operation request according to the front end resource information of the operation request and the gray object list, and obtaining gray request; the method comprises the steps of obtaining version information of a gray request, routing the gray request to a target gray service according to the version information of the gray request and a gateway routing rule in a gray release version, and operating the target gray service to obtain gray request feedback, wherein the target gray service is identical to a gray version number and a URL path of the gray request;
the gray release version release module 103 is configured to adjust a target gray service according to the gray request feedback, update a gray object list, and complete gray release based on a micro service architecture.
In detail, the modules in the gray level distribution device 100 based on the micro service architecture in the embodiment of the present invention use the same technical means as the gray level distribution method based on the micro service architecture described in fig. 1, and can generate the same technical effects, which is not described herein.
Example 3: fig. 3 is a schematic structural diagram of an electronic device for implementing a gray level distribution method based on a micro-service architecture according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11, a bus 12 and a communication interface 13, and may further comprise a computer program stored in the memory 11 and executable on the processor 10, such as a greyscale distribution program based on a micro-service architecture.
The processor 10 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, combinations of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects respective components of the entire electronic device using various interfaces and lines, executes or executes programs or modules (for example, gradation release programs based on a micro-service architecture, etc.) stored in the memory 11, and invokes data stored in the memory 11 to perform various functions of the electronic device 1 and process the data.
The bus may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The bus is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc.
Fig. 3 shows only an electronic device with components, it being understood by a person skilled in the art that the structure shown in fig. 3 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or may combine certain components, or may be arranged in different components.
For example, although not shown, the electronic device 1 may further include a power source (such as a battery) for supplying power to each component, and preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device 1 may further include various sensors, bluetooth modules, wi-Fi modules, etc., which will not be described herein.
Further, the electronic device 1 may also comprise a network interface, optionally the network interface may comprise a wired interface and/or a wireless interface (e.g. WI-FI interface, bluetooth interface, etc.), typically used for establishing a communication connection between the electronic device 1 and other electronic devices.
The electronic device 1 may optionally further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device 1 and for displaying a visual user interface.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The gray level distribution program based on the micro-service architecture stored in the memory 11 of the electronic device 1 is a combination of a plurality of instructions, which when executed in the processor 10, can implement:
Designating an initial gray scale service and a gray scale front end of gray scale release according to a preset gray scale release plan, and configuring a gray scale release version by utilizing the initial gray scale service and the gray scale front end;
acquiring configuration information of a gray level front end, and designating a service object of gray level release according to the configuration information of the gray level front end to obtain a gray level object list;
registering the initial gray scale service into Nacos to obtain a target gray scale service, acquiring a configuration file of the Nacos, and designating a gray scale version number of the target gray scale service by using the configuration file of the Nacos; the obtaining the configuration file of the Nacos, and designating the gray scale version number of the target gray scale service by using the configuration file of the Nacos comprises the following steps:
receiving a configuration file acquisition instruction, and constructing a secure connection with a pre-constructed Nacos configuration service;
extracting identification information of a target gray scale service from the configuration file acquisition instruction, and acquiring a configuration file of Nacos according to the identification information;
analyzing the configuration file of the Nacos to obtain configuration information related to the target gray scale service;
identifying a gray scale version number of the target gray scale service from the configuration information;
acquiring configuration information and local routing rules of a target gray scale service, configuring version routing rules by using the configuration information and gray scale version number of the target gray scale service, and dynamically and synchronously updating the local routing rules according to the version routing rules to obtain gateway routing rules;
Based on Spring Cloud Gateway gateway receiving operation request, obtaining front end resource information of the operation request, screening the operation request according to the front end resource information of the operation request and the gray object list, and obtaining gray request;
the method comprises the steps of obtaining version information of a gray request, routing the gray request to a target gray service according to the version information of the gray request and a gateway routing rule in a gray release version, and operating the target gray service to obtain gray request feedback, wherein the target gray service is identical to a gray version number and a URL path of the gray request;
and feeding back and adjusting the target gray scale service according to the gray scale request, updating a gray scale object list, and finishing gray scale release based on a micro-service architecture.
Specifically, the specific implementation method of the above instruction by the processor 10 may refer to descriptions of related steps in the corresponding embodiments of fig. 1 to 2, which are not repeated herein.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.