Movatterモバイル変換


[0]ホーム

URL:


CN113741909B - Micro-service deployment method and device, electronic equipment and storage medium - Google Patents

Micro-service deployment method and device, electronic equipment and storage medium
Download PDF

Info

Publication number
CN113741909B
CN113741909BCN202111011681.8ACN202111011681ACN113741909BCN 113741909 BCN113741909 BCN 113741909BCN 202111011681 ACN202111011681 ACN 202111011681ACN 113741909 BCN113741909 BCN 113741909B
Authority
CN
China
Prior art keywords
deployment
micro
service
cluster
mirror
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.)
Active
Application number
CN202111011681.8A
Other languages
Chinese (zh)
Other versions
CN113741909A (en
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.)
Ping An International Smart City Technology Co Ltd
Original Assignee
Ping An International Smart City 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 Ping An International Smart City Technology Co LtdfiledCriticalPing An International Smart City Technology Co Ltd
Priority to CN202111011681.8ApriorityCriticalpatent/CN113741909B/en
Publication of CN113741909ApublicationCriticalpatent/CN113741909A/en
Application grantedgrantedCritical
Publication of CN113741909BpublicationCriticalpatent/CN113741909B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The invention relates to artificial intelligence technology, providing a micro-service deployment method, firstly forming a main configuration file based on an expected built micro-service project, then generating a deployment template based on the main configuration file, then establishing a correlation channel through the deployment template and preset cluster information, and then placing the constructed mirror image text and the deployment template in a target environment through the correlation channel to complete deployment.

Description

Micro-service deployment method and device, electronic equipment and storage medium
Technical Field
The invention relates to an artificial intelligence technology, and in particular relates to a micro-service deployment method, a micro-service deployment device, electronic equipment and a computer readable storage medium.
Background
In the development process of the springboot micro-service project, a development environment (dev), a test environment (test), a pre-release environment (uat) and a production environment (prd) are frequently existing, and different configuration environment files are correspondingly existing.
When a specified environment needs to be deactivated in the main configuration file application. Yml, such as a package test environment (test), when different environments are packaged, an activation test environment needs to be configured in the main configuration file application. Yml; while deploying different environments requires frequent modification to update the master profile, and the profiles that activate the different environments must be specified in the master profile. Thus, there are two drawbacks: first, a developer needs to make deployment packages of different environments for the same springboot micro-service module, for example: development environment packages, test environment packages and the like, and a large number of module service packages can make the development environment packages and the test environment packages redundant in a deployment stage, so that certain deployment pressure is caused for operation and maintenance delivery personnel; secondly, if the configuration information of a certain environment needs to be updated, the configuration information needs to be immediately repackaged and delivered to operation and maintenance personnel for delivering deployment, so that the configuration flexibility is reduced.
Therefore, a micro-service deployment method which is flexible in configuration, effective in control, capable of reducing the deployment error rate and improving the template utilization rate is needed.
Disclosure of Invention
The invention provides a micro-service deployment method, which aims to solve the problems that deployment packages in different environments need to be played by a developer on the same springboot micro-service module, so that deployment is more redundant, and a certain deployment pressure is caused for operation and maintenance delivery personnel; and if the configuration information of a certain environment needs to be updated, the configuration information needs to be repackaged to operation and maintenance personnel to deliver the deployment, so that the problem of poor configuration flexibility is solved.
In order to achieve the above object, the present invention provides a micro-service deployment method, including:
defining variables based on the micro-service items expected to be built to form a master profile;
generating a deployment template based on the master profile;
establishing an association channel with preset cluster information through the deployment template;
and placing the constructed mirror image text and the deployment template in a target environment through the association channel to complete deployment.
Optionally, the defining variables based on the micro service items expected to be built to form a main configuration file includes:
connecting the micro-service and the server through a preset connecting channel to form a project embryonic form;
constructing a micro-service framework in the micro-service project prototype through a custom algorithm;
Creating a configuration file in a resource file of the micro service framework according to the specification information of the micro service; wherein, at least an ID variable, a port variable, a micro-service name and a configuration address are defined in the configuration file;
carrying out standardization processing on the configuration files to form main configuration files; the normalization process initializes assignments for ID variables, initializes assignments for port variables, digitizes micro-service names, and digitizes configuration addresses.
Optionally, the generating a deployment template based on the master profile includes:
performing deep analysis on the main configuration file to form configuration characters;
configuring mirror images according to the configuration characters, naming the mirror images according to preset rules, and obtaining mirror image names;
setting up deployment parameters corresponding to the mirror names according to the mirror functions;
and filling the deployment parameters into a preset template to obtain a deployment template.
Optionally, the establishing an association channel with the preset cluster information through the deployment template includes:
collecting a pre-deployment cluster of the micro service items;
acquiring cluster information of the pre-deployment cluster; wherein the cluster information at least comprises a cluster address;
And determining the module name of the micro service item, calling the deployment template according to the module name, and matching the deployment template with the cluster address to form an associated channel.
Optionally, the collecting the pre-deployed cluster of the micro-service items includes:
traversing and extracting the main configuration file to obtain a resource file in the main configuration file;
acquiring resource information in the resource file to capture a connection character string;
the pre-deployment cluster is acquired according to the correspondence of the connection character string and the cluster name in the cluster library; the cluster library is a database preset in advance, and names of all clusters related to the micro service items are stored in the database.
Optionally, the placing the constructed mirror text and the deployment template in the target environment through the association channel to complete deployment includes:
creating mirror image text;
forming a packaging environment script aiming at the mirror image text;
testing the packaging environment script, and taking the packaging environment script as a target environment if the packaging environment script passes the test;
and placing the mirror script and the deployment template in the target environment based on the association channel to complete deployment.
Optionally, the creating the mirror image text includes:
calling a mirror image corresponding to the mirror image name according to the mirror image name;
constructing a mirror script for the mirror;
describing the mirror script through a mirror image instruction to form a mirror image text; wherein the mirror text at least comprises instruction logic instructions required for constructing the mirror text.
In order to solve the above problems, the present invention also provides a micro service deployment apparatus, the apparatus comprising:
the file configuration unit is used for defining variables based on the micro service items expected to be built to form a main configuration file;
a deployment template unit for generating a deployment template based on the master profile;
the association channel unit is used for establishing an association channel with preset cluster information through the deployment template;
and the target deployment unit is used for placing the constructed mirror image text and the deployment template in a target environment through the association channel so as to complete deployment.
In order to solve the above-mentioned problems, the present invention also provides an electronic apparatus including:
a memory storing at least one instruction; and
And the processor executes the instructions stored in the memory to realize the steps in the micro-service deployment method.
In order to solve the above-mentioned problems, the present invention also provides a computer-readable storage medium having stored therein at least one instruction that is executed by a processor in an electronic device to implement the above-mentioned micro-service deployment method.
According to the embodiment of the invention, the main configuration file is formed based on the micro-service project which is expected to be built, the deployment template is generated based on the main configuration file, the association channel is established through the deployment template and the preset cluster information, and the constructed mirror image text and the deployment template are placed in the target environment through the association channel to complete deployment.
Drawings
FIG. 1 is a flowchart of a micro-service deployment method according to an embodiment of the present invention;
FIG. 2 is a schematic block diagram of a micro-service deployment device according to an embodiment of the present invention;
fig. 3 is a schematic diagram of an internal structure of an electronic device according to a micro-service deployment method according to an embodiment of the present invention;
the achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
In the current stage of springboot microservice project, for the configuration of multiple environments, the basic thought is as follows: firstly, configuring configuration files of a plurality of different environments, and then, distinguishing and packaging after the contents to be packaged are designated through a packaging command. The multi-environment profile needs to satisfy the format of application- { profile }. Yml; wherein { profile } corresponds to the identity of the different environments; the following files are typically required in the project:
application. Yml Main Profile
application-dev. Yml development Environment Profile
application-test. Yml test Environment Profile
application-uart. Yml Pre-release Environment Profile
application-prd.yml production Environment Profile
As to which of the above files to be used in the springboot microservice item is loaded, one of the configuration files needs to be activated in the main configuration file application. Yml by the spring. Profiles. Active (for activating the configuration file function) attribute, for example, to use the test environment application-test. Yml, then the following needs to be configured in the main configuration file: spring.profiles.active=test (stands for project activation test environment configuration file), so that the configuration file of the test environment is loaded when the micro-service is started: application-test. Yml; obviously, redundancy is configured for the service module at the present stage, and a plurality of configuration parties are required to realize the micro-service function.
In this embodiment, the micro-service deployment method includes:
s1: defining variables based on the micro-service items expected to be built to form a master profile;
s2: generating a deployment template based on the master profile;
s3: establishing an association channel through the deployment template and preset cluster information;
s4: and placing the constructed mirror image text and the deployment template in a target environment through a correlation channel to complete deployment.
In the embodiment shown in fig. 1, step S1 is a process of forming a master profile based on micro service items that are expected to be set up; wherein, the process of forming the main configuration file based on the expected built micro service items comprises the following steps:
s11: connecting the micro-service and the server through a preset connecting channel to form a project embryonic form;
s12: constructing a micro-service framework in the micro-service project prototype through a custom algorithm;
s13: defining variables in a resource file of the micro service framework according to the specification information of the micro service to create a configuration file; the variables in the configuration file are at least defined with an ID variable, a port variable, a micro-service name and a configuration address;
s14: carrying out standardization processing on the configuration files to form main configuration files; the normalization process initializes assignments for ID variables, initializes assignments for port variables, digitizes micro-service names, and digitizes configuration addresses.
The standardized processing comprises project ID variable assignment (initialization assignment), port variable assignment (initialization assignment), micro-service name digitization and configuration address digitization;
in step S11, the project prototype is a micro-service description based on natural language and graphics, which is automatically configured and obtained by a computer in this embodiment; in other words, it is a micro service, and the connection status, the function status and the layout status of the server adapted to the architecture of the micro service;
in step S12, the micro service framework is a digital mode micro service framework converted according to the micro service in step S11, the connection status, the function status and the layout status of the server adapted to the architecture matched with the micro service;
in step S13, a configuration file is created in a resource file of the micro service frame, that is, the micro service frame in the digital mode is automatically opened first, then a traversing search is performed in a resource library of the micro service frame to find a resource file, and a configuration file is created in a giant resource file, which in this embodiment is application.
In step S14, the ID variable is (app_id), that is, the configuration file is first assigned (app_id), where the app_id may be in a digital format or a letter sequence, which may be a sequence that indicates the order of the configuration file, and in this embodiment, the app_id is a letter and number sequence, that is, app_001, app_002, so that naming, arrangement, and calling of the configuration file are facilitated;
And carrying out port variable configuration to set the port number of the server matched with the configuration file, and digitizing the micro-service name and the configuration address to form a complete main configuration file.
In the embodiment shown in fig. 1, step S2 is a process of generating a deployment template based on a master profile, in which the generating of the deployment template based on the master profile includes:
s21: deep analysis is carried out on the main configuration file to form configuration characters;
s22: configuring mirror images according to configuration characters, naming the mirror images according to preset rules, and obtaining mirror image names; the preset rule is known before the micro service is deployed, in other words, the mirror name may be named according to the requirement of the micro service, or may be named according to the ordering of the micro service in the whole large service system, or may even be named by the function of the micro service, which is not particularly limited herein.
S23: setting up deployment parameters corresponding to the mirror image names according to the function setting of the mirror image; in this embodiment, the functions of the images are known, that is, each image has a respective function, so that parameter configuration is performed according to the function setting of the image, and a deployment parameter adapted to the function of the image is obtained, where the deployment parameter includes a parameter of an ID variable assignment, a parameter of a port variable assignment, a micro-service name parameter, and a configuration address parameter.
S24: and filling the deployment parameters into a preset template to obtain the deployment template.
Specifically, step S21 is a process of converting the configuration file into a character mode, that is, converting the configuration file into a character form first, so as to lay a character foundation for obtaining the configuration parameters subsequently;
step S22 is a process of configuring and naming the mirror image, such as directly inputting the name of the mirror image for connection with the mirror image;
s23 is a process of forming a deployment parameter, wherein the deployment parameter is a specific numerical value, namely, the project ID variable, the port variable, the micro-service name and the configuration address mentioned in the step S3 are digitized, and independent numbers are given to the project ID variable, the port variable, the micro-service name and the configuration address;
step S24 is a process of filling parameters, i.e. filling configuration parameters into a preset template to form a deployment template, wherein the preset template is preset in advance, in this embodiment, firstly, a variable configuration template is defined, for example, some agreed variable information, such as variables app_ NAMESPAC, APOLLO _meta, app_id, app_name, etc., is defined, the preset template is formed by defining the variable information, then, specific values of the defined variables can be configured in the preset template, and when all values are determined, i.e. the values of the variables of the preset template are configured, the deployment template is formed.
In the embodiment shown in fig. 1, step S3 is a process of establishing an association channel with preset cluster information through a deployment template; the process of establishing the association channel through the deployment template and the preset cluster information comprises the following steps:
s31: collecting a pre-deployment cluster of micro-service items;
s32: acquiring cluster information of a pre-deployment cluster; wherein the cluster information at least comprises a cluster address;
s33: determining the module name of the micro service item, calling a deployment template according to the module name, and matching the deployment template with the cluster address to form an associated channel.
Specifically, step S31 is a step of acquiring a name of a pre-deployment cluster, where a process of acquiring the pre-deployment cluster of the micro service item includes:
s311: traversing and extracting the main configuration file to obtain a resource file in the main configuration file;
s312: acquiring resource information in a resource file to capture a connection character string;
s313: corresponding to the cluster names in the cluster library according to the connection character strings to obtain a pre-deployment cluster; the cluster library is a database preset in advance, and names of all clusters related to the micro service item are stored in the database;
step S32 is a step of acquiring cluster information of the pre-deployment cluster, so as to lay a foundation for the establishment of connection in the next step;
Step S33 firstly determines the module name of the micro service item, namely, firstly determines which function module of the micro service item is to be used, then determines a deployment template belonging to the function module to be called later, and thus, the deployment template is associated with the cluster address, so that the association of the micro service module to be used and the cluster address can be realized, and the basis of an association channel is laid for deployment;
that is, before deployment, firstly, the module name of the micro service item to be deployed is determined, the deployment template name to be used is determined, and the deployed cluster address is determined, so that the micro service module to be used, the deployment cluster address and the deployment template name are effectively associated, in this embodiment, the configuration image warehouse address and the item name of the warehouse can be determined at the same time, so that the user can effectively manage and use the well-arranged image.
In the embodiment shown in fig. 1, step S4 is a process of placing the constructed mirror text and the deployment template in the target environment through the association channel to complete the deployment; wherein, include:
s41: creating mirror image text;
s42: forming a packaging environment script aiming at the mirror image text;
S43: testing the packing environment script, and taking the packing environment script as a target environment if the packing environment script passes the test;
s44: placing the mirror script and the deployment template in a target environment based on the association channel to complete deployment;
specifically, step S41 is a process of creating a mirror image text, which includes:
s411: calling a mirror image corresponding to the mirror image name according to the mirror image name;
s412: constructing a mirror script for the mirror;
s413: describing the mirror script through a mirror image instruction to form a mirror image text; the mirror image text at least comprises instruction logic instructions required for constructing the mirror image text;
firstly, calling a mirror image, then editing a mirror image script aiming at the mirror image, and logically explaining the mirror image to form the mirror image script;
step S42 is a process of forming a package environment script, in this embodiment, environment label labeling is required, and a specific labeling mode is not particularly limited, and in this embodiment, the following is shown:
i.e., if the environment variables are to be configured, please remove the following # notes
env:
Name ENV_TAG# environmental Label
value stg# test Environment
-name:APP_ID
value variable value of micro service ID
-name:APP_NAME
value variable value of micro-service name
-name:APOLLO_META
value-APOLLO_META configuration address information
-name:APP_NAMESPACE
value: apollo configuration information required by the microservice;
step S43, firstly, testing the package environment script, if the package environment script passes the test, taking the package environment script as a target environment, wherein the specific test method is not particularly limited, and the test environment is 1.8java version;
step S44 is a process of placing the image script and the deployment template in the target environment based on the association channel to complete the deployment, where the deployed environment is stg (test) or prd (use), and the deployment template name is: xxx-service, mirror name: xxx-service0-0-1; the mirror name must be consistent with the mirror name in the deployment template, otherwise, errors in which the mirror cannot be found can occur in deployment; configuring a deployment environment name, a deployment module name and a deployment mirror name (the mirror name is consistent with a deployment template), so as to ensure that a micro service is accurately and effectively connected with a cluster;
in short, the above steps only keep the main configuration file application. Yml, in which variables such as app_ NAMESPAC, APOLLO _meta, app_id, app_name, etc. are used to configure information, through which specific variable values can be configured in the deployment template; after the values of the deployment template variables are configured, the deployment environment is determined through the association of the deployment environment type and the deployment environment, and the deployment cluster information is determined through the association of the deployment environment and the cluster address (cluster information); the cluster information is associated with the deployment template name to determine template information required by deployment; through the association relation, the information of the deployment template can be transmitted to the micro-service, so that the micro-service can be started up in normal operation. In a word, through simplifying configuration, the configuration file has good readability, and interaction with the deployment template and the micro-service is easier. Therefore, the environment types of package deployment are not required to be managed by a developer, the burden of distinguishing different environment deployment packages is reduced for operation and maintenance personnel, the deployment environment is effectively controlled outside projects, and the deployment error rate is reduced.
In addition, the method also comprises a periodical updating strategy mechanism, namely after deployment is completed, the method also comprises the step S5: detecting whether the parameters of the deployment template have deviation or not by a follow-up mechanism regularly, if the parameters of the deployment template do not have deviation, continuing to use the deployment template, if the parameters of the deployment template have deviation, creating a configuration file in a resource file of the micro-service frame again, and carrying out standardized processing on the newly created configuration file to form a new main configuration file; the specific detection mode is not particularly limited, in this embodiment, if the ID variable configuration value, the port variable configuration value, the micro-service name and the configuration address in the main configuration file are different from the characters or bytes defined in the primary normalization process, a deviation exists, and the situation rarely occurs, but by adding the regular update policy mechanism, accidental generation can be greatly avoided, and the configuration stability is improved.
In this embodiment, the server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
As described above, the micro-service deployment method provided by the invention firstly forms a main configuration file based on the micro-service project which is expected to be built, then generates a deployment template based on the main configuration file, establishes a correlation channel with preset cluster information through the deployment template, and places the constructed mirror image text and the deployment template in a target environment through the correlation channel to complete deployment.
As described above, in the embodiment shown in FIG. 1, the micro service deployment method provided by the present invention has the following advantages: (1) simplifying micro-service item configuration: by removing development environment (application-dev. Yml), test environment (application-test. Yml), pre-release environment (application-ut. Yml), production environment (application-prd. Yml) configuration files after improvement and simplification, only a main configuration file application. Yml is reserved, and information is configured in the main configuration file by using variables; thus, redundancy of configuration in the micro-service project is reduced, so that project configuration is more simplified; (2) the configuration is flexible: the developer and the operation and maintenance personnel restrict environmental variables; the configuration is modified in the later period, only the deployment template is required to be modified, so that the project deployment of operation and maintenance personnel is more convenient, and the operation and maintenance personnel does not need to distinguish which environment the jar of the project is packaged into, and the deployment environment is completely delivered to the operation and maintenance personnel to be effectively controlled in the deployment template; (3) reducing multi-environment jar packet redundancy: the developer only pays attention to service development, submits codes to a master branch of a code warehouse, does not pay attention to which environment the jar package is the package of, and only one configuration file in the project is effective, namely only one main configuration file application. Yml in the project, so that each micro-service module only needs to be packaged once, and is deployed to what environment, and the service module is completely and flexibly controlled by operation and maintenance personnel, and the operation and maintenance personnel can configure the deployment template according to specific requirements, thereby achieving the purpose of adapting to different environments.
As shown in fig. 2, the present invention provides a micro-service deployment apparatus 100, which may be installed in an electronic device. Depending on the functions implemented, the micro-service deployment device 100 may include a file configuration unit 101, a deployment template unit 102, an association channel unit 103, and a target deployment unit 104. 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.
In the present embodiment, the functions concerning the respective modules/units are as follows:
a file configuration unit 101 for defining variables based on the micro service items expected to be set up to form a master configuration file;
a deployment template unit 102 for generating a deployment template based on the master profile;
an association channel unit 103, configured to establish an association channel with preset cluster information through a deployment template;
the target deployment unit 104 is configured to place the constructed mirror text and the deployment template in the target environment through the association channel to complete the deployment.
The process of defining variables to form a master profile by the file configuration unit 101 based on the micro service items expected to be built includes:
S11: connecting the micro-service and the server through a preset connecting channel to form a project embryonic form;
s12: constructing a micro-service framework in the micro-service project prototype through a custom algorithm;
s13: defining variables in a resource file of the micro service framework according to the specification information of the micro service to create a configuration file; the variables in the configuration file are at least defined with an ID variable, a port variable, a micro-service name and a configuration address;
s14: carrying out standardization processing on the configuration files to form main configuration files; the normalization process initializes assignments for ID variables, port variables, micro-service name and configuration address.
The standardized processing comprises project ID variable configuration values, port variable configuration values, micro-service name digitization and configuration address digitization;
in step S11, the project prototype is a micro-service description based on natural language and graphics, which is automatically configured and obtained by a computer in this embodiment; in other words, it is a micro service, and the connection status, the function status and the layout status of the server adapted to the architecture of the micro service;
in step S12, the micro service framework is a digital mode micro service framework converted according to the micro service in step S11, the connection status, the function status and the layout status of the server adapted to the architecture matched with the micro service;
In step S13, a configuration file is created in a resource file of the micro service frame, that is, the micro service frame in the digital mode is automatically opened first, then a traversing search is performed in a resource library of the micro service frame to find a resource file, and a configuration file is created in a giant resource file, which in this embodiment is application.
In step S14, the ID variable is (app_id), that is, the configuration file is first assigned (app_id), where the app_id may be in a digital format or a letter sequence, which may be a sequence that indicates the order of the configuration file, and in this embodiment, the app_id is a letter and number sequence, that is, app_001, app_002, so that naming, arrangement, and calling of the configuration file are facilitated;
and carrying out port variable configuration to set the port number of the server matched with the configuration file, and digitizing the micro-service name and the configuration address to form a complete main configuration file.
The deployment template unit 102 generates a deployment template based on the master profile, including:
s21: deep analysis is carried out on the main configuration file to form configuration characters;
s22: configuring mirror images according to configuration characters, naming the mirror images according to preset rules, and obtaining mirror image names;
S23: setting up deployment parameters corresponding to mirror names according to the mirror functions; the deployment parameters comprise parameters of ID variable assignment values, parameters of port variable assignment values, micro-service name parameters and configuration address parameters;
s24: and filling the deployment parameters into a preset template to obtain the deployment template.
Specifically, step S21 is a process of converting the configuration file into a character mode, that is, converting the configuration file into a character form first, so as to lay a character foundation for obtaining the configuration parameters subsequently;
step S22 is a process of configuring and naming the mirror image, such as directly inputting the name of the mirror image for connection with the mirror image;
s23 is a process of forming a deployment parameter, wherein the deployment parameter is a specific numerical value, namely, the project ID variable, the port variable, the micro-service name and the configuration address mentioned in the step S3 are digitized, and independent numbers are given to the project ID variable, the port variable, the micro-service name and the configuration address;
step S24 is a process of filling parameters, i.e. filling configuration parameters into a preset template to form a deployment template, wherein the preset template is preset in advance, in this embodiment, firstly, a variable configuration template is defined, for example, some agreed variable information, such as variables app_ NAMESPAC, APOLLO _meta, app_id, app_name, etc., is defined, the preset template is formed by defining the variable information, then, specific values of the defined variables can be configured in the preset template, and when all values are determined, i.e. the values of the variables of the preset template are configured, the deployment template is formed.
The process of establishing the association channel by the association channel unit 103 through the deployment template and the preset cluster information includes:
s31: collecting a pre-deployment cluster of micro-service items;
s32: acquiring cluster information of a pre-deployment cluster; wherein the cluster information at least comprises a cluster address;
s33: determining the module name of the micro service item, calling a deployment template according to the module name, and matching the deployment template with the cluster address to form an associated channel.
Specifically, step S31 is a step of acquiring a name of a pre-deployment cluster, where a process of acquiring the pre-deployment cluster of the micro service item includes:
s311: traversing and extracting the main configuration file to obtain a resource file in the main configuration file;
s312: acquiring resource information in a resource file to capture a connection character string;
s313: corresponding to the cluster names in the cluster library according to the connection character strings to obtain a pre-deployment cluster; the cluster library is a database preset in advance, and names of all clusters related to the micro service item are stored in the database;
step S32 is a step of acquiring cluster information of the pre-deployment cluster, so as to lay a foundation for the establishment of connection in the next step;
Step S33 firstly determines the module name of the micro service item, namely, firstly determines which function module of the micro service item is to be used, then determines a deployment template belonging to the function module to be called later, and thus, the deployment template is associated with the cluster address, so that the association of the micro service module to be used and the cluster address can be realized, and the basis of an association channel is laid for deployment;
that is, before deployment, firstly, the module name of the micro service item to be deployed is determined, the deployment template name to be used is determined, and the deployed cluster address is determined, so that the micro service module to be used, the deployment cluster address and the deployment template name are effectively associated, in this embodiment, the configuration image warehouse address and the item name of the warehouse can be determined at the same time, so that the user can effectively manage and use the well-arranged image.
The target deployment unit 104 places the constructed mirror image text and the deployment template in a target environment through the association channel to complete the deployment process; wherein, include:
s41: creating mirror image text;
s42: forming a packaging environment script aiming at the mirror image text;
s43: testing the packing environment script, and taking the packing environment script as a target environment if the packing environment script passes the test;
S44: placing the mirror script and the deployment template in a target environment based on the association channel to complete deployment;
specifically, step S41 is a process of creating a mirror image text, which includes:
s411: calling a mirror image corresponding to the mirror image name according to the mirror image name;
s412: constructing a mirror script for the mirror;
s413: describing the mirror script through a mirror image instruction to form a mirror image text; the mirror image text at least comprises instruction logic instructions required for constructing the mirror image text;
firstly, calling a mirror image, then editing a mirror image script aiming at the mirror image, and logically explaining the mirror image to form the mirror image script;
step S42 is a process of forming a package environment script, in this embodiment, environment label labeling is required, and a specific labeling mode is not particularly limited, and in this embodiment, the following is shown:
i.e., if the environment variables are to be configured, please remove the following # notes
env:
Name ENV_TAG# environmental Label
value stg# test Environment
-name:APP_ID
value variable value of micro service ID
-name:APP_NAME
value variable value of micro-service name
-name:APOLLO_META
value-APOLLO_META configuration address information
-name:APP_NAMESPACE
value: apollo configuration information required by the microservice;
step S43, firstly, testing the package environment script, if the package environment script passes the test, taking the package environment script as a target environment, wherein the specific test method is not particularly limited, and the test environment is 1.8java version;
Step S44 is a process of placing the image script and the deployment template in the target environment based on the association channel to complete the deployment, where the deployed environment is stg (test) or prd (use), and the deployment template name is: xxx-service, mirror name: xxx-service0-0-1; the mirror name must be consistent with the mirror name in the deployment template, otherwise, errors in which the mirror cannot be found can occur in deployment; configuring a deployment environment name, a deployment module name and a deployment mirror name (the mirror name is consistent with a deployment template), so as to ensure that a micro service is accurately and effectively connected with a cluster;
in short, the above steps only keep the main configuration file application. Yml, in which variables such as app_ NAMESPAC, APOLLO _meta, app_id, app_name, etc. are used to configure information, through which specific variable values can be configured in the deployment template; after the values of the deployment template variables are configured, the deployment environment is determined through the association of the deployment environment type and the deployment environment, and the deployment cluster information is determined through the association of the deployment environment and the cluster address (cluster information); the cluster information is associated with the deployment template name to determine template information required by deployment; through the association relation, the information of the deployment template can be transmitted to the micro-service, so that the micro-service can be started up in normal operation. In a word, through simplifying configuration, the configuration file has good readability, and interaction with the deployment template and the micro-service is easier. Therefore, the environment types of package deployment are not required to be managed by a developer, the burden of distinguishing different environment deployment packages is reduced for operation and maintenance personnel, the deployment environment is effectively controlled outside projects, and the deployment error rate is reduced.
In addition, a policy updating unit (not shown in the figure) may be further included, where the policy updating unit is configured to periodically detect whether there is a deviation between the parameters of the deployment template and the update mechanism, if there is no deviation, continue to use the deployment template, and if there is a deviation, create a configuration file in the resource file of the micro service frame again, and perform a normalization process on the newly created configuration file to form a new main configuration file; the specific detection mode is not particularly limited, in this embodiment, if the ID variable configuration value, the port variable configuration value, the micro-service name and the configuration address in the main configuration file are different from the characters or bytes defined in the primary normalization process, a deviation exists, and the situation rarely occurs, but by adding the regular update policy mechanism, accidental generation can be greatly avoided, and the configuration stability is improved.
As described above, in the micro-service deployment device 100 provided by the invention, a main configuration file is formed by the file configuration unit 101 based on the micro-service project which is expected to be set up, a deployment template is generated by the deployment template unit 102 based on the main configuration file, a correlation channel is established by the correlation channel unit 103 through the deployment template and preset cluster information, and then the built mirror image text and the deployment template are placed in a target environment by the target deployment unit 104 through the correlation channel to complete deployment.
As shown in fig. 3, the present invention provides an electronic device 1 implementing a micro-service deployment method.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as a micro-service deployment program 12, stored in the memory 11 and executable on said processor 10.
The memory 11 includes at least one type of readable storage medium, including flash memory, a mobile hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may in other embodiments also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only for storing application software installed in the electronic device 1 and various types of data, such as codes for micro service deployment, but also for temporarily storing data that has been output or is to be output.
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, and executes various functions of the electronic device 1 and processes data by running or executing programs or modules (e.g., micro service deployment programs, etc.) stored in the memory 11, and calling data stored in the memory 11.
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 micro-service deployment program 12 stored in the memory 11 of the electronic device 1 is a combination of instructions that, when executed in the processor 10, can implement:
defining variables based on the micro-service items expected to be built to form a master profile;
generating a deployment template based on the master profile;
establishing an association channel through the deployment template and preset cluster information;
and placing the constructed mirror image text and the deployment template in a target environment through a correlation channel to complete deployment.
Wherein the process of defining variables to form a master profile based on the micro-service items expected to be built includes:
connecting the micro-service and the server through a preset connecting channel to form a project embryonic form;
constructing a micro-service framework in the micro-service project prototype through a custom algorithm;
defining variables in a resource file of the micro service framework according to the specification information of the micro service to create a configuration file; the variables in the configuration file are at least defined with an ID variable, a port variable, a micro-service name and a configuration address;
carrying out standardization processing on the configuration files to form main configuration files; the normalization process initializes assignments for ID variables, port variables, micro-service name and configuration address.
A process for generating a deployment template based on a master profile, comprising:
deep analysis is carried out on the main configuration file to form configuration characters;
configuring mirror images according to configuration characters, naming the mirror images according to preset rules, and obtaining mirror image names;
setting up deployment parameters corresponding to mirror names according to the mirror functions; the deployment parameters comprise parameters of ID variable assignment values, parameters of port variable assignment values, micro-service name parameters and configuration address parameters;
And filling the deployment parameters into a preset template to obtain the deployment template.
The process of establishing the association channel through the deployment template and the preset cluster information comprises the following steps:
collecting a pre-deployment cluster of micro-service items;
acquiring cluster information of a pre-deployment cluster; wherein the cluster information at least comprises a cluster address;
determining the module name of the micro service item, calling a deployment template according to the module name, and matching the deployment template with the cluster address to form an associated channel.
A process of collecting pre-deployed clusters of micro-service items, comprising:
traversing and extracting the main configuration file to obtain a resource file in the main configuration file;
acquiring resource information in a resource file to capture a connection character string;
corresponding to the cluster names in the cluster library according to the connection character strings to obtain a pre-deployment cluster; the cluster library is a database preset in advance, and names of all clusters related to the micro service item are stored in the database.
Placing the constructed mirror image text and the deployment template in a target environment through a correlation channel to complete the deployment process, wherein the process comprises the following steps:
creating mirror image text;
forming a packaging environment script aiming at the mirror image text;
Testing the packing environment script, and taking the packing environment script as a target environment if the packing environment script passes the test;
placing the mirror script and the deployment template in a target environment based on the association channel to complete deployment;
the process of creating the mirror text includes:
calling a mirror image corresponding to the mirror image name according to the mirror image name;
constructing a mirror script for the mirror;
describing the mirror script through a mirror image instruction to form a mirror image text; wherein the mirror text includes at least instruction logic instructions required to construct the mirror text.
Specifically, the specific implementation method of the above instructions by the processor 10 may refer to the description of the relevant steps in the corresponding embodiment of fig. 1, which is not repeated herein. It should be emphasized that, to further ensure the privacy and security of the foregoing micro-service deployment, the data of the foregoing micro-service deployment is stored in the node of the blockchain where the present server cluster is located.
The server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
Further, the modules/units integrated in the electronic device 1 may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as separate products. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
Embodiments of the present invention also provide a computer readable storage medium, which may be non-volatile or volatile, storing a computer program which when executed by a processor implements:
defining variables based on the micro-service items expected to be built to form a master profile;
generating a deployment template based on the master profile;
establishing an association channel through the deployment template and preset cluster information;
and placing the constructed mirror image text and the deployment template in a target environment through a correlation channel to complete deployment.
In particular, the specific implementation method of the computer program when executed by the processor may refer to the description of the relevant steps in the embodiment micro service deployment method, which is not described herein in detail.
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.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
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.

Claims (7)

CN202111011681.8A2021-08-312021-08-31Micro-service deployment method and device, electronic equipment and storage mediumActiveCN113741909B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202111011681.8ACN113741909B (en)2021-08-312021-08-31Micro-service deployment method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202111011681.8ACN113741909B (en)2021-08-312021-08-31Micro-service deployment method and device, electronic equipment and storage medium

Publications (2)

Publication NumberPublication Date
CN113741909A CN113741909A (en)2021-12-03
CN113741909Btrue CN113741909B (en)2024-04-12

Family

ID=78734214

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202111011681.8AActiveCN113741909B (en)2021-08-312021-08-31Micro-service deployment method and device, electronic equipment and storage medium

Country Status (1)

CountryLink
CN (1)CN113741909B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114185555A (en)*2021-12-132022-03-15建信金融科技有限责任公司Server deployment method and device and electronic equipment
CN114356343B (en)*2021-12-212024-12-24深圳兆日科技股份有限公司 Microservice product rapid deployment method, device, equipment and readable storage medium
CN114115954B (en)*2022-01-252022-05-17北京金堤科技有限公司Method and device for automatically and integrally deploying service, electronic equipment and storage medium
CN114546473A (en)*2022-02-232022-05-27北京金堤科技有限公司Method and device for automatically and integrally deploying service, electronic equipment and storage medium
CN114741092B (en)*2022-04-212024-08-09平安国际智慧城市科技股份有限公司Multi-tenant deployment method, device, equipment and storage medium for traditional application
CN114924971A (en)*2022-05-272022-08-19中国银行股份有限公司Test environment deployment method and device
CN114995808A (en)*2022-06-132022-09-02中国银行股份有限公司Method and device for quickly building micro-service engineering
CN115562688B (en)*2022-10-132023-10-03深圳市中兴新云服务有限公司Micro-service and component fusion-based one-key deployment method

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108762769A (en)*2018-06-042018-11-06万惠投资管理有限公司Micro services application layout and dispositions method, device and terminal
CN111666080A (en)*2020-04-282020-09-15平安科技(深圳)有限公司Micro-service cluster deployment method and device, computer equipment and storage medium
CN111708571A (en)*2020-06-172020-09-25珠海宏桥高科技有限公司 Microservice deployment method, device, electronic device and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US11579941B2 (en)*2019-05-052023-02-14Mastercard International IncorporatedControl cluster for multi-cluster container environments

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108762769A (en)*2018-06-042018-11-06万惠投资管理有限公司Micro services application layout and dispositions method, device and terminal
CN111666080A (en)*2020-04-282020-09-15平安科技(深圳)有限公司Micro-service cluster deployment method and device, computer equipment and storage medium
CN111708571A (en)*2020-06-172020-09-25珠海宏桥高科技有限公司 Microservice deployment method, device, electronic device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
企业开发、测试环境快速部署方案的设计与实现;徐星;李银桥;刘学锋;毛建华;;工业控制计算机;20180325(03);全文*

Also Published As

Publication numberPublication date
CN113741909A (en)2021-12-03

Similar Documents

PublicationPublication DateTitle
CN113741909B (en)Micro-service deployment method and device, electronic equipment and storage medium
CN113806434B (en)Big data processing method, device, equipment and medium
CN112085217B (en)Method, device, equipment and computer medium for deploying artificial intelligence service
CN112506559B (en)Gray release method and device based on gateway, electronic equipment and storage medium
CN112653760B (en)Cross-server file transmission method and device, electronic equipment and storage medium
CN112506779A (en)Software interface testing method and device, electronic equipment and storage medium
CN107038519A (en)Production Lifecycle Management(PLM)System and Source code management(SCM)Bi-directional data between system is synchronous
CN115102770A (en)Resource access method, device and equipment based on user permission and storage medium
CN113238929A (en)Code testing method and device based on Mock data, electronic equipment and storage medium
CN113434254B (en)Client deployment method, client deployment apparatus, computer device, and storage medium
CN112541688B (en)Service data verification method and device, electronic equipment and computer storage medium
CN113704665A (en)Dynamic service publishing method, device, electronic equipment and storage medium
CN112214256B (en)Machine learning operation control method and device, electronic equipment and storage medium
CN114860314B (en)Deployment upgrading method, device, equipment and medium based on database compatibility
CN115269554A (en)Tree data management method, device, equipment and medium based on multi-service scene
CN116205764A (en)Purchase contract generation method, device, equipment and medium
CN115757121A (en)Test method, device, equipment and storage medium built based on test environment
CN114723400A (en)Business authorization management method, device, equipment and storage medium
CN116107991A (en)Container label database construction method and device, storage medium and electronic equipment
CN113886108A (en)Network point data calling method and device, electronic equipment and storage medium
CN115934576B (en)Test case generation method, device, equipment and medium in transaction scene
CN114741092B (en)Multi-tenant deployment method, device, equipment and storage medium for traditional application
CN116028020B (en) Microservice processing method, device, equipment and storage medium based on customer differences
CN113626533B (en)Ultraviolet power detection method and device and electronic equipment
CN118277502A (en)Data storage method, device, equipment and medium based on task type dialogue system

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp