Deployment method based on dynamic service discovery

Through dynamic service discovery registration center and deployment scripts, the optimal deployment method is automatically selected based on service attributes and operating status, solving the problem of large resource overhead in the existing technology, realizing zero downtime deployment and automated rollback, and shortening deployment time.

CN120295639APending Publication Date: 2025-07-11BEIJING SIMULATION CENT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510383582.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-28
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

The existing technology cannot automatically select the optimal deployment strategy based on the attributes and operating status of each service, and relies on container technologies such as Docker, resulting in large resource overhead and long deployment time.

Method used

Through dynamic service discovery registry, deployment configuration files and deployment scripts, the optimal deployment method is automatically selected based on the service's attributes and operating status, including direct deployment, restart deployment and port replacement and restart deployment, supporting zero downtime deployment and automated rollback.

Benefits of technology

Shorten deployment time, avoid service interruptions, reduce overhead of storage space and computing resources, and support automated rollback operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295639A_ABST
    Figure CN120295639A_ABST
Patent Text Reader

Abstract

The invention discloses a deployment method based on dynamic service discovery, and the method comprises the steps: determining the deployment mode of each to-be-deployed service according to the attribute, operation state and process state of each service in a deployment configuration file, and the deployment mode comprises a direct deployment mode, a restart deployment mode and a port replacement restart deployment mode; performing deployment operation on the to-be-deployed services according to the deployment modes of the to-be-deployed services, and if the deployment is successful, automatically registering to a dynamic service discovery registration center; and if the deployment fails or the deployment is overtime, stopping the deployment. The deployment mode is automatically selected according to the attribute and the running state of the to-be-deployed service, repeated running and restarting of the same service are avoided, the deployment time is shortened, and service interruption is avoided; according to the method, the deployment mode is achieved through the deployment script, the method does not depend on container technologies such as Docker, and the expenditure of storage space and computing resources is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software deployment. More specifically, it relates to a deployment method based on dynamic service discovery. Background Art

[0002] Software deployment refers to all activities that make a software system reach an available state, including installation, configuration, running, updating, and rollback, etc. In a complex software system, multiple services are usually involved, and the attributes and deployment methods of each service are different. Dynamic Service Discovery refers to the technology of automatically identifying and discovering available services in a distributed system, including two key steps: service registration and service discovery. Among them, service registration means that a service process provides metadata such as host, port, service name, and version number to a registration center; service discovery means that a client obtains information about a specific service process that is currently available from the registration center. The software deployment method based on dynamic service discovery relies on container technologies such as Docker and requires high storage space and computing resources.

[0003] To ensure the availability of services during software deployment, the deployment method of directly stopping the old version service and then running the new version service is usually not adopted. Zero Downtime Deployment means that during the entire process of deploying a new version of an application, there is no need to interrupt the service, and users can always access the application normally without perceiving any service interruption. For example, in blue-green deployment, the service running in the production environment is called the blue version, and the new version is deployed in parallel as the green version; when the green version is successfully deployed, the green version is switched to the version running in the production environment, and finally the blue version service is stopped. The zero downtime deployment method cannot automatically select the optimal deployment strategy according to the attributes and running status of each service. The zero downtime deployment method only supports service rollback operations under specific conditions, and there are special scenarios where it is difficult to perform rollbacks or manual intervention is required. Summary of the Invention

[0004] The present invention provides a deployment method based on dynamic service discovery to solve at least one of the problems existing in the prior art.

[0005] To achieve the above object, the present invention adopts the following technical solutions:

[0006] The present invention provides a deployment method based on dynamic service discovery, and the method includes

[0007] Determining the deployment method of each service to be deployed according to the attributes, running status, and process status of each service in the deployment configuration file, where the deployment method includes a direct deployment method, a restart deployment method, and a port replacement and restart deployment method;

[0008] Perform a deployment operation on the service to be deployed according to the deployment method of each service to be deployed. If the deployment is successful, automatically register with the dynamic service discovery registry; if the deployment fails or times out, abort the deployment.

[0009] Optionally, the performing the deployment operation according to the deployment method includes

[0010] Within a preset time, query the service to be deployed through the dynamic service discovery registry and monitor the process status, and judge the deployment result according to the query result and the process status: if the service is queried within the preset time, it is determined that the deployment is successful; if the process disappears within the preset time, it is determined that the deployment fails; if there is a process within the preset time and the service cannot be queried, it is determined that the deployment times out.

[0011] Optionally, the method further includes

[0012] Read the deployment configuration file through a deployment script to obtain the marked status of each service to be deployed, where the marked status is that the service to be deployed has an in-place port deployment mark or the service to be deployed has no in-place port deployment mark.

[0013] Optionally, the judging the deployment method of each service to be deployed includes

[0014] Judge the deployment method of the service to be deployed according to the running status of the service. If the service is in an unrun state, it is determined to be a direct deployment method;

[0015] If the service is in a running state, judge whether the service to be deployed is running on the target port. If the service to be deployed is running on the target port, it is determined to be a restart deployment method;

[0016] If the service to be deployed is not running on the target port, judge whether the target port is occupied. If the target port is not occupied, it is determined to be a port replacement and restart deployment method; if the target port is occupied, it is determined to be an error, and perform a deployment operation on other services to be deployed.

[0017] Optionally, for the service to be deployed with a direct deployment method, the deployment operation includes

[0018] Execute the deployment command in the deployment configuration file on the target port to start the new version of the service, and judge whether the new version of the service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, perform a deployment operation on the next service to be deployed; if the deployment fails or times out, end the new version of the service on the target port, abort the deployment, and perform a deployment operation on the next service to be deployed.

[0019] Optionally, for the service to be deployed without an in-place port deployment mark and with a restart deployment method, the deployment operation includes

[0020] Start the legacy service through a temporary port, and determine whether the legacy service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, end the legacy service on the target port and perform a deployment operation on the next service to be deployed; if the deployment fails or times out, abort the deployment and perform a deployment operation on the next service to be deployed.

[0021] Start the new version service through the target port, and determine whether the new version service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, end the legacy service on the temporary port and perform a deployment operation on the next service to be deployed; if the deployment fails or times out, end the legacy service on the temporary port, abort the deployment, and perform a deployment operation on the next service to be deployed.

[0022] Optionally, for a service to be deployed with an in-place port deployment flag and a restart deployment method, the deployment operation includes

[0023] End the legacy service on the target port;

[0024] Start the new version service on the target port, and determine whether the new version service is successfully deployed according to the dynamic service discovery registry. If the deployment is successful, end the new version service on the target port and perform a deployment operation on the next service to be deployed; if the deployment fails or times out, end the new version service on the target port, restart the legacy service on the target port, abort the deployment, and perform a deployment operation on the next service to be deployed.

[0025] Optionally, for a service to be deployed without an in-place port flag and a replacement restart deployment method, the deployment operation includes

[0026] Start the new version service through the target port, and determine whether the new version service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, end the legacy service on the original port and perform a deployment operation on the next service to be deployed; if the deployment fails or times out, end the new version service on the target port, abort the deployment, and perform a deployment operation on the next service to be deployed.

[0027] Optionally, for a service to be deployed with an in-place port deployment flag and a port replacement restart deployment method, the deployment operation includes

[0028] Give a warning prompt;

[0029] Start the new version of the service through the target port, and determine whether the new version of the service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, end the old version of the service on the original port and perform the deployment operation on the next service to be deployed; if the deployment fails or times out, end the new version of the service on the target port, abort the deployment, and perform the deployment operation on the next service to be deployed.

[0030] Optionally, the method further includes

[0031] If the deployment result of the service to be deployed is deployment failure or timeout, perform a rollback operation.

[0032] The beneficial effects of the present invention are as follows:

[0033] The present invention automatically selects the deployment method according to the attributes and running status of the service to be deployed, avoiding the repeated running and restarting of the same service, shortening the deployment time, and avoiding service interruption; the present invention realizes the deployment method through a deployment script, does not depend on container technologies such as Docker, and reduces the overhead of storage space and computing resources. Description of the Drawings

[0034] The following further details the specific embodiments of the present invention with reference to the drawings.

[0035] Figure 1 Show the flowchart of the deployment method based on dynamic service discovery of the present invention;

[0036] Figure 2 Show the flowchart of the present invention for judging the deployment method. Specific Embodiments

[0037] To illustrate the present invention more clearly, the following further describes the present invention with reference to the preferred embodiments and the drawings. Similar components in the drawings are denoted by the same reference numerals. Those skilled in the art should understand that the content specifically described below is illustrative rather than restrictive, and should not be used to limit the protection scope of the present invention.

[0038] Existing software deployment methods cannot automatically select the optimal deployment strategy according to the attributes and running status of each service, and only support service rollback operations under specific conditions. There are special scenarios where it is difficult to perform rollback, or manual intervention is required. Existing software deployment methods based on dynamic service discovery rely on container technologies such as Docker and require high storage space and computing resources. The present invention proposes a deployment method based on dynamic service discovery, which automatically selects the optimal deployment method through the running status detection technology of the dynamic service discovery registry, shortens the deployment time, and supports automated rollback operations for the deficiencies of software deployment methods; it does not depend on container technologies such as Docker and can be realized only through scripts, with small resource overhead.

[0039] The present invention proposes a deployment method based on dynamic service discovery, which performs zero-downtime deployment on the service to be deployed and its dependent libraries through three parts: a dynamic service discovery registry, a deployment configuration file, and a deployment script. Among them, the dynamic service discovery registry runs on a dynamic service discovery server, is responsible for receiving the running status sent by each service, and provides an interface for listing information such as the host, port, service name, and version number of all registered services. The deployment configuration file is updated during each deployment, and the updated content includes the deployment path, temporary port, list of services to be deployed, as well as information such as the deployment command, dependent library path, running port, timeout, and in-place port deployment flag for each service to be deployed. The deployment script is a script program written in languages such as Python and Shell, including algorithms such as certain deployment methods, detection methods, rollback strategies, and service running status detection methods.

[0040] Figure 1 is a flowchart of the deployment method based on dynamic service discovery, and the method includes

[0041] Determine the deployment method of each service to be deployed according to the attributes, running status, and process status of each service in the deployment configuration file. The deployment methods include direct deployment method, restart deployment method, and port replacement restart deployment method;

[0042] Judge the deployment method of the service to be deployed according to the running status of the server. If the server is in an unrun state, it is determined as the direct deployment method;

[0043] If the server is in a running state, judge whether the service to be deployed is running on the target port. If the service to be deployed is running on the target port, it is determined as the restart deployment method;

[0044] If the service to be deployed is not running on the target port, judge whether the target port is occupied. If the target port is not occupied, it is determined as the port replacement restart deployment method; if the target port is occupied, it is determined as an error, and the deployment operation is performed on other services to be deployed.

[0045] Perform deployment operations on the services to be deployed according to the deployment methods of each service to be deployed. If the deployment is successful, automatically register with the dynamic service discovery registry; if the deployment fails or times out, abort the deployment.

[0046] Within a preset time, query the service to be deployed through the dynamic service discovery registry and monitor the process status, and judge the deployment result according to the query result and the process status: if the service is queried within the preset time, it is determined that the deployment is successful; if the process disappears within the preset time, it is determined that the deployment fails; if there is a process within the preset time and the service cannot be queried, it is determined that the deployment times out.

[0047] When the deployment of the service to be deployed fails or times out, a rollback operation is performed.

[0048] The method further includes

[0049] Reading the deployment configuration file through the deployment script to obtain the marked status of each service to be deployed, where the marked status is that the service to be deployed has an in-place port deployment mark or the service to be deployed has no in-place port deployment mark.

[0050] Before deploying the service, read the deployment configuration file through the deployment script to obtain the marked status of each service to be deployed; access the dynamic service discovery and registration center through the deployment script, and judge the deployment method of each service to be deployed according to the attributes of each service to be deployed in the deployment configuration file, the running status of each service to be deployed returned by the dynamic service discovery and registration center, and the service process status, and ask the user who executes the deployment to interactively confirm.

[0051] The marked status of each service to be deployed is that the service to be deployed has an in-place port deployment mark or the service to be deployed has no in-place port deployment mark; the deployment methods of each service to be deployed include direct deployment method, restart deployment method, and port replacement and restart deployment method.

[0052] After the user confirms the deployment, perform multiple different deployment operations according to the deployment method and the in-place port mark. If the deployment is successful, automatically register with the dynamic service discovery and registration center, and perform the deployment operation on the next service to be deployed; if the deployment fails or times out, record the type of deployment error and record the reason for the deployment error in the log, abort the deployment of this service, perform the rollback operation according to the rollback policy, and perform the deployment operation on the next service to be deployed.

[0053] For the service to be deployed with the direct deployment method, there is no need to distinguish the in-place port deployment mark at this time, and the deployment operations include

[0054] Execute the deployment command in the deployment configuration file at the target port to start the new version of the service, and judge whether the new version of the service is successfully deployed according to the status of the dynamic service discovery and registration center. If the deployment is successful, perform the deployment operation on the next service to be deployed; if the deployment fails or times out, end the new version of the service at the target port, record the type of deployment error, and record the reason for the error, abort the deployment of this service, perform the rollback operation according to the rollback policy, and perform the deployment operation on the next service to be deployed.

[0055] For the service to be deployed without the in-place port deployment mark and with the restart deployment method, the deployment operations include

[0056] Start the legacy service through a temporary port, and determine whether the legacy service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, end the legacy service on the target port and perform the deployment operation on the next service to be deployed; if the deployment fails or times out, abort the deployment and perform the deployment operation on the next service to be deployed.

[0057] Start the new version service through the target port, and determine whether the new version service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, end the legacy service on the temporary port and perform the deployment operation on the next service to be deployed; if the deployment fails or times out, end the legacy service on the temporary port, abort the deployment, and perform the deployment operation on the next service to be deployed.

[0058] For services to be deployed with an in-place port deployment flag and a restart deployment method, the deployment operation includes

[0059] First, end the legacy service on the target port; start the new version service on the target port, and determine whether the new version service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, automatically register with the dynamic service discovery registry and perform the deployment operation on the next service to be deployed; if the deployment fails or times out, end the new version service on the target port, restart the legacy service on the target port, record the reason for the deployment failure or timeout, abort the deployment of this service, and perform the deployment operation on the next service to be deployed.

[0060] For services to be deployed without an in-place port flag and a replacement restart deployment method, the deployment operation includes

[0061] Start the new version service through the target port, and determine whether the new version service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, automatically register with the dynamic service discovery registry and perform the deployment operation on the next service to be deployed; if the deployment fails or times out, end the new version service on the target port, record the reason for the deployment failure or timeout, abort the deployment of this service, end the legacy service on the original port, and perform the deployment operation on the next service to be deployed.

[0062] For services to be deployed with an in-place port deployment flag and a port replacement restart deployment method, the deployment operation includes

[0063] Give a warning prompt that this service can only run on a specific port, and the deployment method requires port replacement, so a warning prompt is given. If the user confirms to continue the execution, then continue with the port replacement restart deployment method; if the user confirms not to execute, then the deployment method needs to be terminated for correction;

[0064] Start the new version of the service through the target port. Determine whether the new version of the service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, automatically register with the dynamic service discovery registry and perform the deployment operation on the next service to be deployed. If the deployment fails or times out, end the new version of the service on the target port, record the reason for the deployment failure or timeout, abort the deployment of this service, end the old version of the service on the original port, and perform the deployment operation on the next service to be deployed.

[0065] When the deployment script of the present invention runs on the server, it automatically selects the optimal strategy from the direct deployment method, the restart deployment method, and the port replacement restart deployment method according to information such as whether the service is running, whether the service is running on the target port, and whether the target port is occupied, avoiding the repeated running and restarting of the same service and shortening the deployment time. The deployment strategy used in the present invention can be implemented through a script and does not depend on container technologies such as Docker, and can be implemented only through a script, reducing the overhead of storage space and computing resources. The rollback strategy used in the present invention can automatically process various intermediate states caused by deployment interruptions and supports rolling back the service itself and its dependent library files.

[0066] In a specific embodiment, before service deployment, the deployment script reads the service list and the dependent library list in the deployment configuration file and accesses the dynamic service discovery registry to query the running status of all current services; check whether the temporary port is occupied, and if it is occupied, report an error and exit. Figure 2 It is a method flow chart for judging the deployment method. For each service, access the dynamic service discovery registry to check whether the service is running and running on the target port to determine the deployment method of the service to be deployed.

[0067] According to Figure 2 , if the service is not running, it is determined that the deployment method is the direct deployment method;

[0068] If the service is running and running on the target port, it is determined that the deployment method is the restart deployment method;

[0069] If the service is running but not running on the target port, check whether the target port is occupied. If the target port is occupied, it is determined as an error; if the target port is not occupied, it is determined that the deployment method is the port replacement restart deployment method.

[0070] Check whether there is an in-place port deployment flag for the service to be deployed in the deployment configuration file. If there is an in-place port deployment flag, the service can only run on a fixed port and cannot run on a temporary port, that is, the legacy service cannot be started on a temporary port. For the service to be deployed with an in-place port flag and a port replacement restart deployment method, at this time the service can only run on a specific port, and the deployment method requires port replacement, so a warning is given to prompt the user whether it meets the requirements. If it meets the requirements and the user confirms to continue the execution, then continue to execute the port replacement restart deployment method; if it does not meet the user's requirements and the user confirms not to execute, then the deployment needs to be terminated and corrected. After checking all services, perform deployment operations or warning prompts according to whether there is an in-place port deployment flag in the deployment method, and ask the user for interactive confirmation.

[0071] The user confirms the deployment and performs different deployment operations according to the execution policy:

[0072] For the service to be deployed with a direct deployment method, at this time there is no need to distinguish whether the service to be deployed has an in-place port deployment flag. The deployment operations include

[0073] Execute the deployment command in the deployment configuration file on the target port to start the new version of the service. Determine whether the service is successfully deployed by accessing the dynamic service discovery and registration center. The dynamic service discovery and registration center determines whether the service is successfully deployed according to the running status information sent by a certain service received. If the deployment is successful, perform the deployment operation on the next service to be deployed; if the deployment fails or times out, end the new version of the service on the target port, record the reason for the deployment failure or timeout, abort the deployment of this service, and perform the deployment operation on the next service to be deployed. If a certain service is aborted during the deployment process due to deployment failure or timeout, it will not affect the next service, and the deployment operation of the next service in the list of services to be deployed will also continue to be executed.

[0074] The dynamic service discovery and registration center determines whether the service is successfully deployed according to the running status information sent by a certain service received, including

[0075] After executing the deployment command on the target port, a process of the service will be generated. If the process runs normally, the process will register the service with the dynamic service discovery center, and the service instance can be queried within the preset time. At this time, it is determined that the service deployment is successful; if no process is generated or the process disappears within the preset time, it is determined that the service deployment fails; if a process is generated within the preset time but the process does not register the service with the dynamic service discovery center, that is, the service instance cannot be queried within the preset time, it is determined that the deployment times out.

[0076] For the service to be deployed without an in-place port deployment flag and with a restart deployment method, the deployment operations include

[0077] Start the legacy service on the temporary port, access the dynamic service discovery registry to confirm whether the service is successfully deployed. If the deployment is successful, end the legacy service on the target port and perform the deployment operation on the next service to be deployed. If the deployment fails or times out, abort the deployment.

[0078] After ending the legacy service on the target port, start the new version service on the target port. Determine whether the service is successfully deployed based on the running status information of the service received by the dynamic service discovery registry. If the deployment fails or times out, end the new version service on the target port, start the legacy service on the target port, end the legacy service on the temporary port, record the reason for the deployment failure or timeout, abort the deployment, and perform the deployment operation on the next service to be deployed. If the deployment is successful, end the legacy service on the temporary port and perform the deployment operation on the next service to be deployed.

[0079] For the service to be deployed with an in-place port deployment flag and a restart deployment method, the deployment operation includes

[0080] First, end the legacy service on the target port, start the new version service on the target port. Determine whether the service is successfully deployed based on the running status information of the service received by the dynamic service discovery registry. If the deployment fails or times out, end the new version service on the target port, start the legacy service on the target port, record the reason for the deployment failure or timeout, and abort the deployment. If the deployment is successful, end the new version service on the target port and perform the deployment operation on the next service to be deployed.

[0081] For the service to be deployed without an in-place port flag and a replacement restart deployment method, the deployment operation includes

[0082] Execute the deployment command in the deployment configuration file on the target port to start the new version service. Determine whether the service is successfully deployed based on the running status information of the service received by the dynamic service discovery registry. If the deployment is successful, end the legacy service on the original port and perform the deployment operation on the next service to be deployed. If the deployment fails or times out, end the new version service on the target port, record the reason for the deployment failure or timeout, abort the deployment, and perform the deployment operation on the next service to be deployed.

[0083] For the service to be deployed with an in-place port deployment flag and a port replacement restart deployment method, the deployment operation includes

[0084] Give a warning prompt, which does not affect subsequent deployment operations, remind users of potential errors in the deployment configuration file, and prompt users to confirm whether it meets the user's requirements. If it meets the user's requirements, continue to execute the port replacement and restart deployment method; if it does not meet the user's requirements, terminate the service deployment for correction. Execute the deployment command in the deployment configuration file on the target port to start the new version of the service. Determine whether the service is successfully deployed according to the running status information of the service received by the dynamic service discovery registry. If the deployment is successful, end the old version of the service on the original port and perform the deployment operation on the next service to be deployed; if the deployment fails or times out, end the new version of the service on the target port, record the reason for the deployment failure or timeout, abort the deployment, and perform the deployment operation on the next service to be deployed.

[0085] The target port in this embodiment is the port where the service to be deployed is expected to be deployed in this deployment. Each service to be deployed has a different target port; the temporary port is used to provide a temporary service. Before the deployment, an old version of the service is already running on the target port. That is, an old version of the service needs to be started on the temporary port first, and then the old version of the service running on the target port is ended to avoid service interruption; the state transition in the port replacement and restart deployment method is: from the old version of the service running on the original port to the new version of the service running on the target port, where the original port is the port where the old version of the service ran before the deployment operation.

[0086] It should be noted that before starting the new version of the service, first access the dynamic service discovery registry to perform a service query to ensure that the old version of the service has ended and no service instance can be queried, so as to avoid misidentifying the unended old version of the service as the successfully deployed new version of the service.

[0087] In this embodiment, if the deployment result of the service to be deployed is a deployment failure or timeout, after aborting the deployment, it is necessary to roll back according to the rollback strategy. Specifically, before performing the deployment of a certain service, obtain the service file name and the list of all dependent library file names for this deployment, and copy the old version of the service file and all dependent library files to the temporary folder; when performing the deployment of this service, use the new version of the service file and all dependent library files to overwrite the old version files; when the deployment of the new version of the service fails or times out and needs to be rolled back, obtain the old version of the service file and all dependent library files from the temporary folder, overwrite the new version files, and then start the old version of the service.

[0088] The present invention reads the deployment configuration file through a deployment script, accesses the dynamic service discovery and registration center, and automatically selects the optimal deployment method according to the attributes and running status of the service to be deployed, avoiding the repeated running and restart of the same service, shortening the deployment time, and avoiding service interruption; the present invention replaces the old version of the service with the new version of the service, realizing service deployment without stopping the software, not relying on container technologies such as Docker, and reducing the overhead of storage space and computing resources; the rollback strategy used in the case of deployment failure or deployment timeout can automatically handle various intermediate states caused by deployment interruption, and supports rolling back the service itself and its dependent library files.

[0089] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by terms such as "upper" and "lower" is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus cannot be understood as a limitation of the present invention. Unless otherwise clearly specified and defined, the terms "installed", "connected" and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected, or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0090] It should also be noted that in the description of the present invention, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.

[0091] Obviously, the above embodiments of the present invention are only examples for clearly illustrating the present invention, rather than limitations on the implementation manners of the present invention. For those of ordinary skill in the art, other different forms of changes or modifications can be made based on the above description. It is impossible to list all the implementation manners here. Any obvious changes or modifications derived from the technical solutions of the present invention still fall within the protection scope of the present invention.

Claims

1. A deployment method based on dynamic service discovery, characterized in that, The method includes determining the deployment method of each service to be deployed according to the attributes, running status, and process status of each service in the deployment configuration file, where the deployment method includes a direct deployment method, a restart deployment method, and a port replacement and restart deployment method; performing a deployment operation on the service to be deployed according to the deployment method of each service to be deployed. If the deployment is successful, automatically register with the dynamic service discovery registry; if the deployment fails or times out, abort the deployment.

2. The method according to claim 1, characterized in that, The performing the deployment operation according to the deployment method includes querying the service to be deployed through the dynamic service discovery registry and monitoring the process status within a preset time, and judging the deployment result according to the query result and the process status: if the service is queried within the preset time, it is determined that the deployment is successful; if the process disappears within the preset time, it is determined that the deployment fails; if there is a process within the preset time and the service cannot be queried, it is determined that the deployment times out.

3. The method according to claim 1, wherein The method further includes reading the deployment configuration file through a deployment script to obtain the marked status of each service to be deployed, where the marked status is that the service to be deployed has an in-place port deployment mark or the service to be deployed does not have an in-place port deployment mark.

4. The method according to claim 3, wherein The judging the deployment method of each service to be deployed includes judging the deployment method of the service to be deployed according to the running status of the service. If the service is in an unrun state, it is determined as the direct deployment method; if the service is in a running state, judge whether the service to be deployed is running on the target port. If the service to be deployed is running on the target port, it is determined as the restart deployment method; if the service to be deployed is not running on the target port, judge whether the target port is occupied. If the target port is not occupied, it is determined as the port replacement and restart deployment method; if the target port is occupied, it is determined as an error, and perform a deployment operation on other services to be deployed.

5. The method according to claim 4, characterized in that, For the service to be deployed with the direct deployment method, the deployment operation includes executing the deployment command in the deployment configuration file on the target port to start the new version of the service, and judging whether the new version of the service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, perform a deployment operation on the next service to be deployed; if the deployment fails or times out, end the new version of the service on the target port, abort the deployment, and perform a deployment operation on the next service to be deployed.

6. The method according to claim 4, wherein For the service to be deployed without an in-place port deployment mark and with the restart deployment method, the deployment operation includes starting the old version of the service through a temporary port, and judging whether the old version of the service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, end the old version of the service on the target port and perform a deployment operation on the next service to be deployed; if the deployment fails or times out, abort the deployment and perform a deployment operation on the next service to be deployed; starting the new version of the service through the target port, and judging whether the new version of the service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, end the old version of the service on the temporary port and perform a deployment operation on the next service to be deployed; if the deployment fails or times out, end the old version of the service on the temporary port, abort the deployment, and perform a deployment operation on the next service to be deployed.

7. The method according to claim 4, characterized in that For a service to be deployed with an in-place port deployment flag and a restart deployment method, the deployment operation includes Ending the legacy service on the target port; Starting the new version of the service on the target port, and judging whether the new version of the service is successfully deployed according to the dynamic service discovery registry. If the deployment is successful, ending the new version of the service on the target port and performing the deployment operation on the next service to be deployed; if the deployment fails or times out, ending the new version of the service on the target port, restarting the legacy service on the target port, aborting the deployment, and performing the deployment operation on the next service to be deployed.

8. The method according to claim 4, wherein For a service to be deployed without an in-place port flag and with a replacement restart deployment method, the deployment operation includes Starting the new version of the service through the target port, and judging whether the new version of the service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, ending the legacy service on the original port and performing the deployment operation on the next service to be deployed; if the deployment fails or times out, ending the new version of the service on the target port, aborting the deployment, and performing the deployment operation on the next service to be deployed.

9. The method according to claim 4, characterized in that For a service to be deployed with an in-place port flag and a port replacement restart deployment method, the deployment operation includes Giving a warning prompt; Starting the new version of the service through the target port, and judging whether the new version of the service is successfully deployed according to the status of the dynamic service discovery registry. If the deployment is successful, ending the legacy service on the original port and performing the deployment operation on the next service to be deployed; if the deployment fails or times out, ending the new version of the service on the target port, aborting the deployment, and performing the deployment operation on the next service to be deployed.

10. The method according to claim 1, wherein The method further includes performing a rollback operation if the deployment result of the service to be deployed is deployment failure or timeout.