Micro-service deployment method and device of hybrid architecture
Technical Field
The invention relates to a cloud computing micro-service technology, in particular to a micro-service deployment method and device of a hybrid architecture.
Background
In the cloud computing era, micro service platforms tend to be more integrated, complicated and diversified. Because the cloud platform is increasingly large in scale and the service logic is increasingly complex, the platform deployment tends to be complex, meanwhile, the resource is excessively wasted due to the idle of the resource, and the cost and the complexity of the service deployment can be greatly saved by the mixed deployment.
Disclosure of Invention
The application provides a micro-service deployment method and device with a mixed architecture, which realize a multi-architecture compatible server of a micro-service system.
The technical scheme is as follows:
the invention provides a micro-service deployment method of a hybrid architecture, which comprises the following steps:
adopting a mirror image warehouse to store mirror image information of one or more types of frameworks;
dynamically reading mirror image information in the mirror image warehouse;
determining a corresponding host architecture according to the read mirror image information;
and realizing service intercommunication according to the host framework.
Preferably, the storing the mirror information of one or more types of architectures by using the mirror repository includes:
the mirror image warehouse records metadata of one or more types of architectures and addresses mirror image addresses corresponding to the one or more types of architectures according to the metadata.
Preferably, the method further comprises, before:
and constructing a micro service system mirror image warehouse.
Preferably, the constructing of the microservice system mirror repository comprises:
writing the operating system architecture and system version information into the mirrored system information application;
an application container engine pushes the mirror image warehouse and pushes mirror image information of the mirror image warehouse to a server;
and when downloading the mirror image warehouse, the client submits the local architecture information and downloads the corresponding mirror image warehouse according to the locally submitted architecture information.
Preferably, the dynamically reading the mirror information in the mirror repository includes:
and dynamically reading the mirror image information in the mirror image warehouse through an Application Program Interface (API).
Preferably, the type of architecture comprises one or more of:
AMD64 architecture, ARM architecture, MIPS architecture, PPC architecture, X86 architecture.
Preferably, determining the corresponding host architecture according to the read image information includes:
extracting data fields representing the meaning of the corresponding host architecture from the data fields of the data structure of the mirror image information according to the operating system architecture and the system version information;
and determining the mirror image information according to the type indicated by the data field to determine the corresponding host architecture.
The invention also provides a micro-service deployment device with a hybrid architecture, which comprises:
the storage module is set to adopt a mirror image warehouse to store mirror image information of one or more types of architectures;
the acquisition module is set to dynamically read the mirror image information in the mirror image warehouse;
the architecture module is arranged for determining a corresponding host architecture according to the read mirror image information;
and the compatible module is set to realize service intercommunication according to the host framework.
Preferably, the storage module stores the mirror image information of one or more types of architectures by using a mirror image warehouse, and the storage module includes:
the mirror image warehouse records metadata of one or more types of architectures and addresses mirror image addresses corresponding to the one or more types of architectures according to the metadata.
Preferably, the determining, by the architecture module, the corresponding host architecture according to the read image information includes:
extracting data fields representing the meaning of the corresponding host computer architecture from the data fields of the data structure of the mirror image information according to the operating system architecture and the system version information;
and determining the mirror image information according to the type indicated by the data field to determine the corresponding host architecture.
The present invention also provides a computer-readable storage medium storing computer-executable instructions for performing the hybrid-architecture microservice deployment method described above.
The invention also provides equipment for realizing the micro-service deployment of the hybrid architecture, which comprises a memory and a processor, wherein the memory stores the micro-service deployment program of the hybrid architecture, and the processor is used for executing the micro-service deployment method of the hybrid architecture when the micro-service deployment program of the hybrid architecture is read.
The application has the following beneficial effects:
according to the method and the system, the kubernets cluster of the mixed architecture is deployed on the container mirror image layer, so that the same micro-service system is compatible with the multi-architecture server, and the actual service of the user can be developed and deployed under different architecture platforms, so that the cloud of the user service can be facilitated, the resources can be fully utilized, the cross-platform repeated development and repeated deployment of the service are reduced, and the waste of resources and the cost of repeated development of personnel are avoided.
Drawings
Fig. 1 is a flowchart of a hybrid architecture microservice deployment method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a hybrid-architecture microservice deployment apparatus according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a hybrid-architecture microservice system according to an embodiment of the present invention.
Detailed Description
The technical solutions of the present application will be described in more detail below with reference to the accompanying drawings and embodiments.
It should be noted that, if not conflicted, the embodiments and the features of the embodiments can be combined with each other and are within the scope of protection of the present application. Additionally, while a logic sequence is shown in the flow diagrams, in some cases, the steps shown or described may be performed in an order different than here.
As shown in fig. 1, an embodiment of the present invention provides a method for deploying micro services in a hybrid architecture, including:
s101, mirror image information of one or more types of frameworks is stored by adopting a mirror image warehouse;
s102, dynamically reading mirror image information in the mirror image warehouse;
s103, determining a corresponding host architecture according to the read mirror image information;
and S104, realizing service intercommunication according to the host framework.
In this embodiment of the present invention, the storing, by using a mirror repository, mirror information of one or more types of architectures in step S101 includes:
the mirror image warehouse records metadata of one or more types of architectures and addresses mirror image addresses corresponding to the one or more types of architectures according to the metadata.
In the embodiment of the present invention, the method further includes:
and constructing a micro service system mirror image warehouse.
In the embodiment of the invention, the constructing of the mirror image warehouse of the micro-service system comprises the following steps:
writing the operating system architecture and system version information into the mirrored system information application;
an application container engine pushes the mirror image warehouse and pushes mirror image information of the mirror image warehouse to a server;
and when downloading the mirror image warehouse, the client submits the local architecture information and downloads the corresponding mirror image warehouse according to the locally submitted architecture information.
In the embodiment of the invention, the implementation process for constructing the mirror image warehouse of the micro-service system is as follows:
1, a Docker client builds a mirror image and writes an operating system architecture and system version information into a manifest of the mirror image;
after Docker pushes the mirror image, the Manifest is submitted to the server at the same time;
3, the Server end processes and records the pushed mirror image information;
4. when the mirror image is downloaded from the server again, the client (client) will submit the local architecture information, and the server will issue the corresponding correct mirror image according to the locally submitted architecture and other information.
In this embodiment of the present invention, the step S102 of dynamically reading the mirror image information in the mirror image repository includes:
and dynamically reading the mirror image information in the mirror image warehouse through an Application Program Interface (API).
In an embodiment of the present invention, the type of the architecture includes one or more of the following:
AMD64 architecture, ARM architecture, MIPS architecture, PPC architecture, X86 architecture.
In this embodiment of the present invention, determining, according to the read image information, a corresponding host architecture in step S103 includes:
extracting data fields representing the meaning of the corresponding host architecture from the data fields of the data structure of the mirror image information according to the operating system architecture and the system version information;
and determining the mirror image information according to the type indicated by the data field to determine the corresponding host architecture.
As shown in fig. 2, an embodiment of the present invention further provides a micro-service deployment apparatus with a hybrid architecture, which includes:
the storage module is set to adopt a mirror image warehouse to store mirror image information of one or more types of architectures;
the acquisition module is set to dynamically read the mirror image information in the mirror image warehouse;
the architecture module is arranged for determining a corresponding host architecture according to the read mirror image information;
and the compatible module is set to realize service intercommunication according to the host framework.
In this embodiment of the present invention, the dynamically reading, by the obtaining module, the mirror image information in the mirror image warehouse includes:
and dynamically reading the mirror image information in the mirror image warehouse through an Application Program Interface (API).
In an embodiment of the present invention, the type of the architecture includes one or more of the following:
AMD64 architecture, ARM architecture, MIPS architecture, PPC architecture, X86 architecture.
In the embodiment of the present invention, the storing module, which stores the mirror image information of one or more types of architectures by using a mirror image warehouse, includes:
the mirror image warehouse records metadata of one or more types of architectures and addresses mirror image addresses corresponding to the one or more types of architectures according to the metadata.
The framework module determines the corresponding host framework according to the read mirror image information, and the method comprises the following steps:
extracting data fields representing the meaning of the corresponding host computer architecture from the data fields of the data structure of the mirror image information according to the operating system architecture and the system version information;
and determining the mirror image information according to the type indicated by the data field to determine the corresponding host architecture. .
Example one
The embodiment of the invention discloses a kubernets deployment process based on a hybrid architecture, which comprises the following steps:
the hybrid architecture cluster of the embodiment of the invention can use AMD64 server, ARM server, MIPS server and PPC server as nodes in a hybrid way, and can have a stronger main node layer. Some Edge clusters or IOT application programs can be deployed in a mixed mode, so that the cloud application under different architectures is facilitated, the cross-platform repeated development and repeated deployment of services are reduced, and the resource waste and the cost of repeated development of personnel are avoided.
1) By constructing a docker mirror image layer of a multi-platform architecture, container mirror images of different architectures are dynamically acquired when a mixed architecture is deployed;
2) opening a Multi-Architecture Manifest in a docker image of a Multi-Architecture, and pushing the Multi-Architecture Manifest to a private warehouse in a deployment environment;
3) the kubernets cluster is deployed through the fusion of the custom tool, and the kubernets are deployed through the custom development tool;
4) and fusing and deploying the service codes through a custom tool.
As shown in fig. 3, the architecture in the embodiment of the present invention mainly includes:
overall design description: the Multi-Architecture management layer of docker is designed so that the container mirror is compatible with the Multi-Architecture platform and the Multi-Architecture container platform can be compatible through one container mirror layer. And simultaneously, a unified kubernets cluster deployment tool and a mirror image management layer are provided.
And (3) related principle display: in order to realize the kubernets deployment method based on the hybrid architecture. As shown in fig. 3, the image information of multiple architectures is fused in the image warehouse through the image manifest layer, and in the kuberntes deployment and delivery process, the container service can dynamically read the image layer in the warehouse through the API to distinguish different host architectures, thereby implementing service intercommunication under different architectures, so as to construct kubernets cluster service of a hybrid architecture, and support service code deployment under different architectures.
The detailed implementation process comprises the following steps: detailed steps for kubernets deployment of hybrid architectures are implemented. The principle demonstration in the relevant principle demonstration is divided into the following steps.
(1) Manufacturing a private mirror image warehouse, supporting mirror image services of mips, arm, amd64, x86 and ppc architectures at present, and starting a corresponding container mirror image after completion;
(2) in servers with different architectures, one server is selected as an execution node, the whole kuberntes cluster can be pulled up after relevant parameters are configured, and the service state is checked
(3) The whole cluster is monitored, part of heterogeneous servers are added into the cluster, seamless addition can be achieved, part of services can be migrated across hosts with different architectures, seamless switching can be achieved, and mirrors of different architectures are automatically matched.
The embodiment of the invention realizes cloud application of the micro-service architecture hybrid architecture, provides a method for saving energy and realizing simple cloud application, and facilitates quick delivery and deployment of IoT and Edge services. The kubernets deployment method based on the hybrid architecture has the following beneficial effects:
(1) the unified mirror layer is used for providing mirror service, a kubernets cluster in a heterogeneous environment is established, and cloud cost of users on different architectures is saved.
(2) Resource cost is saved by using the kubernets cluster of the mixed architecture, and resource cost of management nodes caused by different clusters deployed by different architectures is avoided;
although the embodiments of the present invention have been described above, the contents thereof are merely embodiments adopted to facilitate understanding of the technical aspects of the present invention, and are not intended to limit the present invention. It will be apparent to persons skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined in the appended claims.