CN115396449A - Method, device, equipment and medium for deploying micro-service - Google Patents

Method, device, equipment and medium for deploying micro-service Download PDF

Info

Publication number
CN115396449A
CN115396449A CN202211012644.3A CN202211012644A CN115396449A CN 115396449 A CN115396449 A CN 115396449A CN 202211012644 A CN202211012644 A CN 202211012644A CN 115396449 A CN115396449 A CN 115396449A
Authority
CN
China
Prior art keywords
server
product
service
path
microservice
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211012644.3A
Other languages
Chinese (zh)
Inventor
赵本帅
周斐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur General Software Co Ltd
Original Assignee
Inspur General Software 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 Inspur General Software Co Ltd filed Critical Inspur General Software Co Ltd
Priority to CN202211012644.3A priority Critical patent/CN115396449A/en
Publication of CN115396449A publication Critical patent/CN115396449A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1023Server selection for load balancing based on a hash applied to IP addresses or costs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the specification discloses a method, a device, equipment and a medium for deploying micro-services, which comprise the following steps: deploying a first server calling the API and a second server providing the service in the micro-service; setting a path of a product in the micro service according to a preset service name; polling a path of a product in the microservice through the first server according to a preset period; and if the path of the product in the micro service is not abnormal in the polling result, completing the deployment of the first server and the second server in the micro service, and providing corresponding service through the second server.

Description

Method, device, equipment and medium for deploying micro-service
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for deploying micro services.
Background
With the rise of the micro-service deployment mode, the single application cannot meet the update speed and the deployment mode of the production environment under the new technology, but the micro-service deployment needs to be established in a complex manner, which may cause high operation and maintenance cost and high safety cost. Based on this, in some low-cost development testing and production environments, the deployment of a set of micro service environments becomes an urgent problem to be solved.
Disclosure of Invention
One or more embodiments of the present specification provide a method, an apparatus, a device, and a medium for deploying a microservice, which are used to solve the technical problems in the background art.
One or more embodiments of the present specification adopt the following technical solutions:
one or more embodiments of the present specification provide a method for deploying a microservice, including:
deploying a first server calling the API and a second server providing services in the micro-service;
setting a path of a product in the micro service according to a preset service name;
polling the path of the product in the microservice through the first server according to a preset period;
and if the path of the product in the micro service is not abnormal in the polling result, completing the deployment of the first server and the second server in the micro service, and providing corresponding service through the second server.
Further, before completing the deployment of the first server and the second server in the microservice, the method further includes:
setting an IP address of a product in the micro service;
polling the IP address of the product in the micro service according to a preset period;
and if the IP address of the product in the micro service is not abnormal in the polling result, finishing the deployment of the micro service.
Further, after the deployment of the first server and the second server in the microservice is completed, the method further includes:
recording the IP address and the path of a product in the microservice into a configuration file of the first server, and recording a time stamp in the configuration file;
if the path and the IP address of the product in the microservice are polled through the first server at the next moment of the timestamp, judging whether the path and the IP address of the product in the microservice are recorded in the configuration file or not;
if the path and the IP address of the product in the micro service are recorded in the configuration file, the polling is terminated.
Further, if the path and IP address record of the product in the microservice is not in the configuration file, the method further comprises:
and polling the path and the IP address of the product in the microservice through the first server.
Further, if the path of the product in the micro service is abnormal in the polling result, the product is terminated for service.
Further, after the deployment of the first server and the second server in the microservice is completed, the method further includes:
and dynamically registering the IP address and the path of the product into a load balancing server so as to dynamically adjust the load of the product through the load balancing server.
Further, after the deployment of the first server and the second server in the microservice is completed, the method further includes:
monitoring and diagnosing the access condition of the product.
One or more embodiments of the present specification provide a microservice deployment apparatus, the apparatus comprising:
the system comprises a preliminary deployment unit, a first server and a second server, wherein the first server is used for deploying and calling an API (application programming interface) in the micro-service;
the setting unit is used for setting a path of a product in the micro service according to a preset service name;
the polling unit polls a path of a product in the microservice through the first server according to a preset period;
and the deployment result unit completes the deployment of the first server and the second server in the microservice if the path of the product in the microservice is not abnormal in the polling result, and provides corresponding service through the second server.
One or more embodiments of the present specification provide a microservice deployment apparatus, including:
at least one processor; and (c) a second step of,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
deploying a first server calling the API and a second server providing services in the micro-service;
setting a path of a product in the micro service according to a preset service name;
polling a path of a product in the microservice through the first server according to a preset period;
and if the path of the product in the micro service is not abnormal in the polling result, completing the deployment of the first server and the second server in the micro service, and providing corresponding service through the second server.
One or more embodiments of the present specification provide a non-transitory computer storage medium storing computer-executable instructions configured to:
deploying a first server calling the API and a second server providing the service in the micro-service;
setting a path of a product in the micro service according to a preset service name;
polling a path of a product in the microservice through the first server according to a preset period;
and if the path of the product in the micro service is not abnormal in the polling result, completing the deployment of the first server and the second server in the micro service, and providing corresponding service through the second server.
The embodiment of the specification adopts at least one technical scheme which can achieve the following beneficial effects:
the embodiment of the specification can realize rapid micro-service discovery and survival check based on basic file and network request commands, avoid introducing excessive complexity, and avoid safety problems caused by excessive complexity and assembly deployment.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present specification, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative effort. In the drawings:
FIG. 1 is a flow diagram illustrating a method for deploying a microservice according to one or more embodiments of the present disclosure;
fig. 2 is a schematic structural diagram of a microservice deployment apparatus according to one or more embodiments of the present disclosure;
fig. 3 is a schematic structural diagram of a microservice deployment apparatus according to one or more embodiments of the present specification.
Detailed Description
The embodiment of the specification provides a method, a device, equipment and a medium for deploying micro-services.
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present specification without any creative effort shall fall within the protection scope of the present specification.
Fig. 1 is a schematic flowchart of a method for deploying a microservice according to one or more embodiments of the present specification, where the process may be executed by a microservice deployment system, and may deploy a microservice environment for low-cost development and testing. Certain input parameters or intermediate results in the flow allow for manual intervention adjustments to help improve accuracy.
The method of the embodiment of the specification comprises the following steps:
s102, a first server calling the API and a second server providing the service are deployed in the micro-service.
In the embodiment of the present specification, a plurality of first servers and a plurality of second servers may be deployed according to actual requirements. The first server needs to have access to the second server, and the first server also needs to be able to identify information such as boot files inside the second server and to be able to perform a network connectivity check.
And S104, setting a path of the product in the micro service according to a preset service name.
In this specification embodiment, for verification in the subsequent step, the service name and the port number of the product may be set as the path of the product by writing a file.
And S106, polling the path of the product in the microservice through the first server according to a preset period.
In this embodiment of the present specification, when polling a path of a product in a server, a format of the path may be verified, or a path of the product may be set in advance, and when polling, it is checked whether a current path is the same as a preset path.
And S108, if the path of the product in the micro service is not abnormal in the polling result, completing the deployment of the first server and the second server in the micro service, and providing corresponding service through the second server.
Further, in the embodiment of the present specification, before the deployment of the first server and the second server in the micro service is completed, an IP address of a product in the micro service may be set; polling the IP address of the product in the micro service according to a preset period, wherein the polling of the IP address of the product is carried out in the same way as the polling of the path of the product; if the IP address of the product in the micro service is not abnormal in the polling result, the deployment of the micro service is completed, and the embodiment of the present specification can provide a more stable service for the product of the micro service by means of polling the IP address and the path of the product at the same time.
Further, in this embodiment of the present disclosure, after the deployment of the first server and the second server in the microservice is completed, the IP address and the path of the product in the microservice may be recorded in the configuration file of the first server, and a timestamp may be recorded in the configuration file; if the path and the IP address of the product in the micro service are polled through the first server at the next moment of the timestamp, judging whether the path and the IP address of the product in the micro service are recorded in the configuration file; if the path and the IP address of the product in the micro service are recorded in the configuration file, the polling is terminated. If the path and the IP address of the product in the microservice are not recorded in the configuration file, polling can be performed on the path and the IP address of the product in the microservice through the first server.
Further, in this embodiment of the present specification, if a path of a product in the microservice is abnormal in the polling result, the product may be terminated to service, so as to avoid an error occurring when the product provides a service, and unnecessary loss is brought to a user.
Further, in this embodiment of the present disclosure, after the first server and the second server in the microservice are deployed, the IP address and the path of the product may be dynamically registered in a load balancing server, so that the load of the product is dynamically adjusted by the load balancing server.
Further, in the embodiments of the present description, after the deployment of the first server and the second server in the microservice is completed, the access condition of the product may be monitored and diagnosed. The abnormal servers can be eliminated, and the access number of the servers with high pressure is reduced, so that the load is reduced.
Further, with the rise of internet e-commerce, live and mobile apps, the development model has shifted from the previous release of large versions to the microservice fast iteration model. The single application cannot meet the requirement of fast iterative addition of new characteristics of products, so micro-service deployment is needed. The splitting of the application can lead to more building, for example, zookeeper realizes service registration, or nacos performs service registration discovery, and consul and other tools perform related business processing.
The embodiment of the specification can realize rapid micro-service discovery and survival check based on basic file and network request commands, avoid introducing excessive complexity, and avoid safety problems caused by excessive complexity and assembly deployment.
The embodiment of the present specification may be implemented by the following specific contents, in view of the above technical solutions:
1. in the embodiment of the present specification, deployment discovery and survival check of a microservice can be realized based on a plurality of linux servers, and only path setting needs to be performed on a front-end server during calling, and processing of other switch components is not required.
2. At least 2 sets of servers are required for the embodiments of the present description, one set of servers is used for calling the API, and one set of servers is used for providing specific services. It should be noted that the server calling the API needs to have access to the server providing the specific service, be able to identify boot files and the like within the server, and be able to perform network connectivity checks.
3. In the embodiment of the present description, a product needs to be modified to a certain extent, and after a service is successfully started, a service name and an exposed port number of the product are written to a specific path of the server in a file writing manner. In addition, the embodiment of the specification needs to restrict the IP address of the product, and the IP address can be exposed and used in a format of http:// IP address: port number/service name/xxxx. Embodiments of the present description may use consistent ports for the same service to facilitate routing. Different services use different ports to reduce the waste of server resources and ensure the accuracy of routing.
4. The server calling the API needs to add a list of all servers that provide the service to the list for periodic polling.
4.1 need to poll the files under each server's/app path then record the specific path and IP address into the configuration file of the calling API server for backup.
4.2 after the previous operation is completed, a timestamp operation needs to be recorded, and the next check does not check the file before the timestamp.
4.3 according to the specific path and IP address recorded in 4.1, a call check function can be set, the port is polled once every 5 seconds, if the port is checked for not existing for three times, the specific path and IP address information in the list of 4.1 can be deleted.
4.4 deleting the specific path and IP address which do not survive, at the same time, making a service starting attempt on the IP address of the server providing the service, and deleting the old file which is under the/app directory and indicates success, and backing up the file for use.
5. An interceptor based on kernel implementation can be added on the server calling the API, the IP address of the server is called, and then the routing configuration is carried out by using the configuration file generated in the step 4.1. For example, if the call is http:// call api server IP/service A/xxxx, the IP address of the http:// server A is changed to the port/service A/xxxx corresponding to the service A for transfer and use.
6. Based on the activity checks of 4.3 and 4.4, it is guaranteed that none of the services is called on top of the wrong one.
In addition, the examples of the present specification can also be realized by the following embodiments:
the method comprises the following steps that S1, product optimization and adjustment, server resource setting, product optimization and splitting service deployment are needed, API must be distinguished according to service prefixes, for example, financial accounting is/API/cw fund management is/API/zj, and then service registration is found, and machine modification information on machines enables communication.
S2, the environment for running the service needs to be dynamically registered on a server with balanced load, and an IP address and a specific path are dynamically registered, such as IP1: CW IP2: CW, so that the load can find the appointed machine through the specific path.
And S3, if the service is abnormal, dynamically canceling hosts and other service registration discovery mechanisms to avoid the abnormal condition from occurring when the load is applied to an abnormal machine.
S4, monitoring and diagnosing the access condition, eliminating abnormal servers, reducing the past access number of the route for the server with high pressure, and reducing the load.
Fig. 2 is a schematic structural diagram of a microservice deployment apparatus according to one or more embodiments of the present disclosure, where the apparatus includes: a preliminary deployment unit 202, a setting unit 204, a polling unit 206 and a deployment result unit 208.
A preliminary deployment unit 202, which deploys a first server calling the API and a second server providing the service in the micro-service;
a setting unit 204 for setting a path of a product in the micro service according to a preset service name;
a polling unit 206, which polls the path of the product in the microservice through the first server according to a preset period;
the deployment result unit 208 completes the deployment of the first server and the second server in the microservice if the path of the product in the microservice is not abnormal in the polling result, and provides the corresponding service through the second server.
Fig. 3 is a schematic structural diagram of a deployment apparatus of a microservice according to one or more embodiments of the present specification, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
deploying a first server calling the API and a second server providing the service in the micro-service;
setting a path of a product in the micro service according to a preset service name;
polling a path of a product in the microservice through the first server according to a preset period;
and if the path of the product in the micro service is not abnormal in the polling result, completing the deployment of the first server and the second server in the micro service, and providing corresponding service through the second server.
One or more embodiments of the present specification provide a non-transitory computer storage medium storing computer-executable instructions configured to:
deploying a first server calling the API and a second server providing the service in the micro-service;
setting a path of a product in the micro service according to a preset service name;
polling a path of a product in the microservice through the first server according to a preset period;
and if the path of the product in the micro service is not abnormal in the polling result, completing the deployment of the first server and the second server in the micro service, and providing corresponding service through the second server.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the apparatus, the device, and the nonvolatile computer storage medium, since they are substantially similar to the embodiments of the method, the description is simple, and for the relevant points, reference may be made to the partial description of the embodiments of the method.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The above description is merely one or more embodiments of the present disclosure and is not intended to limit the present disclosure. Various modifications and alterations to one or more embodiments of the present description will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement or the like made within the spirit and principle of one or more embodiments of the present specification should be included in the scope of the claims of the present specification.

Claims (10)

1. A method for deploying microservices, the method comprising:
deploying a first server calling the API and a second server providing the service in the micro-service;
setting a path of a product in the micro service according to a preset service name;
polling a path of a product in the microservice through the first server according to a preset period;
and if the path of the product in the micro service is not abnormal in the polling result, completing the deployment of the first server and the second server in the micro service, and providing corresponding service through the second server.
2. The method of claim 1, wherein before completing the deployment of the first server and the second server in the microservice, the method further comprises:
setting an IP address of a product in the micro service;
polling the IP address of the product in the micro service according to a preset period;
and if the IP address of the product in the micro service is not abnormal in the polling result, finishing the deployment of the micro service.
3. The method of claim 2, wherein after completing the deployment of the first server and the second server in the microservice, the method further comprises:
recording the IP address and the path of a product in the microservice into a configuration file of the first server, and recording a time stamp in the configuration file;
if the path and the IP address of the product in the microservice are polled through the first server at the next moment of the timestamp, judging whether the path and the IP address of the product in the microservice are recorded in the configuration file or not;
if the path and the IP address of the product in the micro service are recorded in the configuration file, the polling is terminated.
4. The method of claim 3, wherein if the path and IP address record of the product in the microservice is not in the configuration file, the method further comprises:
and polling the path and the IP address of the product in the microservice through the first server.
5. The method of claim 1, wherein if the path of the product in the microservice is abnormal in the polling result, the product is terminated from service.
6. The method of claim 2, wherein after completing the deployment of the first server and the second server in the microservice, the method further comprises:
and dynamically registering the IP address and the path of the product into a load balancing server so as to dynamically adjust the load of the product through the load balancing server.
7. The method of claim 2, wherein after completing the deployment of the first server and the second server in the microservice, the method further comprises:
and monitoring and diagnosing the access condition of the product.
8. A microservice deployment apparatus, the apparatus comprising:
the system comprises a preliminary deployment unit, a first server and a second server, wherein the first server is used for deploying and calling an API (application programming interface) in the micro-service;
the setting unit is used for setting a path of a product in the micro service according to a preset service name;
the polling unit polls a path of a product in the microservice through the first server according to a preset period;
and the deployment result unit completes the deployment of the first server and the second server in the microservice if the path of the product in the microservice is not abnormal in the polling result, and provides corresponding service through the second server.
9. A microservice deployment device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
deploying a first server calling the API and a second server providing services in the micro-service;
setting a path of a product in the micro service according to a preset service name;
polling a path of a product in the microservice through the first server according to a preset period;
and if the path of the product in the micro service is not abnormal in the polling result, completing the deployment of the first server and the second server in the micro service, and providing corresponding service through the second server.
10. A non-transitory computer storage medium having stored thereon computer-executable instructions configured to:
deploying a first server calling the API and a second server providing the service in the micro-service;
setting a path of a product in the micro service according to a preset service name;
polling the path of the product in the microservice through the first server according to a preset period;
and if the path of the product in the micro service is not abnormal in the polling result, completing the deployment of the first server and the second server in the micro service, and providing corresponding service through the second server.
CN202211012644.3A 2022-08-23 2022-08-23 Method, device, equipment and medium for deploying micro-service Pending CN115396449A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211012644.3A CN115396449A (en) 2022-08-23 2022-08-23 Method, device, equipment and medium for deploying micro-service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211012644.3A CN115396449A (en) 2022-08-23 2022-08-23 Method, device, equipment and medium for deploying micro-service

Publications (1)

Publication Number Publication Date
CN115396449A true CN115396449A (en) 2022-11-25

Family

ID=84121520

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211012644.3A Pending CN115396449A (en) 2022-08-23 2022-08-23 Method, device, equipment and medium for deploying micro-service

Country Status (1)

Country Link
CN (1) CN115396449A (en)

Similar Documents

Publication Publication Date Title
CN105978781A (en) Method and system for establishing network connection of Docker container, and client side
CN108255708B (en) Method, device, storage medium and equipment for accessing production file in test environment
WO2019153532A1 (en) Deployment method and apparatus for monitoring system, and computer device and storage medium
EP3884620A1 (en) Fast session restoration for latency sensitive middleboxes
CN110928554A (en) Deployment method, device, equipment and storage medium
CN113438292A (en) Agent deployment method and device based on automatic operation and maintenance tool
CN114465791B (en) Method and device for establishing white list in network management equipment, storage medium and processor
CN114168179A (en) Micro-service management method, device, computer equipment and storage medium
CN104111862A (en) Method and system for obtaining IP (Internet Protocol) address of virtual machine in cloud computing platform
CN115396449A (en) Method, device, equipment and medium for deploying micro-service
CN114885365B (en) Business rule detection method and device, electronic equipment and storage medium
US11275674B1 (en) Operations support system (OSS) test tool
CN112752258B (en) eSIM card opening method, mobile phone terminal and service acceptance system
US9176797B1 (en) Workflow processing and methods for auditing and playback of data
CN114938396A (en) Routing method of service call request, method and device for creating service
JP2006285453A (en) Information processor, information processing method, and information processing program
CN112130900A (en) User information management method, system, equipment and medium for BMC
CN112328267A (en) Multi-server installation method and device, terminal and storage medium
CN111447609A (en) Dynamic number allocation method and system
CN111200512A (en) Network connection disaster tolerance method, terminal device, storage medium and electronic device
CN113507388B (en) Equipment deployment configuration method and device, electronic equipment and storage medium
CN117389713B (en) Storage system application service data migration method, device, equipment and medium
CN115905271B (en) Virus library updating method and device and multi-engine detection system
CN111158671B (en) Micro-service architecture software module dynamic loading method based on registration and directional scanning
WO2022269808A1 (en) Network management device, network management method, and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination