A sharding service deployment method, system, device and storage medium

By configuring unique identifiers for service instances in the sharded service deployment of the container cluster management system and performing service registration and discovery operations, the problem that service instance unique identifiers are difficult to compatible with service deployment is solved, and efficient service deployment and complexity are achieved. reduce.

CN115002107BActive Publication Date: 2025-02-18HANGZHOU TUANXING INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210513055.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-11
Publication Date
2025-02-18
Estimated Expiration
2042-05-11

AI Technical Summary

Technical Problem

In the sharded service deployment scenario based on the container cluster management system, the unique identifier of the service instance is difficult to compatible with the service deployment, resulting in an increase in the complexity of service deployment.

Method used

When the target service instance is started, the target unique identifier is obtained from the prebuilt identity directory, and a binding relationship is created in the service instance directory to perform the service registration operation. When listening for the deletion event of the target service instance, delete the binding relationship and record the unique identifier. Periodically traverse the service instance directory to determine the existence of the service instance and process the binding relationship and unique identifier accordingly.

Benefits of technology

Implement service registration and discovery of service instances in a storage-free state, reduce the complexity of sharded service deployment, and further reduce the complexity of service deployment through unique identification reuse.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115002107B_ABST
    Figure CN115002107B_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose a sharded service deployment method, system, device and storage medium. The technical solution provided by the embodiments of the present application obtains the target unique identifier from the pre-built identifier directory when the target service instance is started; then creates the instance name of the target service instance in the service instance directory, binds the target unique identifier to the target service instance to build a binding relationship, and performs the service registration operation of the target service instance; thereafter, when the deletion event of the target service instance is monitored, and / or, when it is determined that the target service instance does not exist in the system cluster, deletes the binding relationship in the service instance directory, and records the target unique identifier back to the identifier directory. The above-mentioned technical means can be used to reduce the complexity of system sharded service deployment while ensuring the efficiency of service deployment. In addition, by recycling the unique identifier when the service is deregistered, the reuse of the unique identifier is achieved, further reducing the complexity of service deployment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a sharding service deployment method, system, device, and storage medium. Background Art

[0002] At present, in the backend service scenario, in order to improve the service deployment efficiency and reduce the complexity of service deployment, when deploying sharded services based on the container cluster management system (Kubernetes), the sharded service deployment will be carried out in the form of stateless load (Deployment). Each service will be transformed into a form without storage state, without a unique identifier and without relying on local memory. In this way, most services can be decoupled from data storage, improve service deployment efficiency, and reduce deployment complexity.

[0003] However, since a unique identifier is required for service registration and discovery when deploying services, this conflicts with the service deployment form without unique identifiers and storage status features. When deploying sharded services, the container cluster management system (Kubernetes) will affect the service instance deployment of the container cluster management system, adding additional service deployment complexity. Summary of the invention

[0004] The embodiments of the present application provide a sharded service deployment method, system, device and storage medium, which can be compatible with the unique identifier of the service instance when deploying the sharded service, and solve the technical problem that the unique identifier of the service instance is difficult to be compatible with the service deployment in the existing sharded service deployment scenario based on the container cluster management system.

[0005] In a first aspect, an embodiment of the present application provides a sharding service deployment method, including:

[0006] When the target service instance is started, the target unique identifier is obtained from the pre-built identifier directory;

[0007] Create an instance name of the target service instance in the service instance directory, bind the target unique identifier to the target service instance to establish a binding relationship, and perform the service registration operation of the target service instance;

[0008] When a deletion event of the target service instance is monitored, the binding relationship is deleted in the service instance directory, and the target unique identifier is recorded back in the identifier directory; and / or,

[0009] Periodically traverse the service instance directory and determine whether the target service instance exists in the system cluster based on the target unique identifier; if it is determined that the target service instance does not exist in the system cluster, delete the binding relationship in the service instance directory and record the target unique identifier back to the identifier directory.

[0010] In a second aspect, an embodiment of the present application provides a sharding service deployment system, including:

[0011] An acquisition module is configured to obtain a target unique identifier from a pre-built identifier directory when a target service instance is started;

[0012] A creation module is configured to create an instance name of a target service instance in a service instance directory, bind a target unique identifier to the target service instance to establish a binding relationship, and perform a service registration operation on the target service instance;

[0013] The recycling module is configured to delete the binding relationship in the service instance directory and record the target unique identifier back to the identification directory when monitoring the deletion event of the target service instance; and / or periodically traverse the service instance directory to determine whether the target service instance exists in the system cluster based on the target unique identifier; if it is determined that the target service instance does not exist in the system cluster, delete the binding relationship in the service instance directory and record the target unique identifier back to the identification directory.

[0014] In a third aspect, an embodiment of the present application provides a sharding service deployment device, including:

[0015] memory and one or more processors;

[0016] The memory is configured to store one or more programs;

[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the sharding service deployment method as described in the first aspect.

[0018] In a fourth aspect, an embodiment of the present application provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are configured to execute the sharding service deployment method as described in the first aspect.

[0019] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes the sharding service deployment method as described in the first aspect.

[0020] The embodiment of the present application obtains the target unique identifier from the pre-built identification directory when the target service instance is started; then creates the instance name of the target service instance in the service instance directory, binds the target unique identifier to the target service instance to build a binding relationship, and performs the service registration operation of the target service instance; thereafter, when the deletion event of the target service instance is monitored, the binding relationship is deleted in the service instance directory, and the target unique identifier is recorded back to the identification directory; and / or, the service instance directory is periodically traversed to determine whether the target service instance exists in the system cluster according to the target unique identifier; when it is determined that the target service instance does not exist in the system cluster, the binding relationship is deleted in the service instance directory, and the target unique identifier is recorded back to the identification directory. By adopting the above technical means, when deploying a shard service based on a container cluster management system, the unique identifier of the target service instance can be configured, and the service registration and discovery operations of the target service instance can be performed, while ensuring the efficiency of service deployment, reducing the complexity of system shard service deployment. In addition, the embodiment of the present application can realize the reuse of the unique identifier by recycling the unique identifier when the service is deregistered, further reducing the complexity of service deployment. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 It is a flowchart of a sharding service deployment method provided in an embodiment of the present application;

[0022] Figure 2 is a service registration flow chart of a target service instance in an embodiment of the present application;

[0023] Figure 3 It is a unique identification recovery flow chart in the embodiment of the present application;

[0024] Figure 4 It is a structural diagram of a sharding service deployment system provided in an embodiment of the present application;

[0025] Figure 5 It is a structural diagram of a sharding service deployment device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.

[0027] The present application provides a shard service deployment method, which aims to configure a unique identifier for the target service instance being deployed when deploying shard services, so that the target service instance can also perform service registration and discovery operations in a non-storage state, thereby reducing the complexity of shard service deployment. Since most services need to rely on their own unique identifier (shard number) for service registration and discovery, as well as monitoring and alarm operations. For example, when shard services are deployed based on a container cluster management system (kubernetes), service deployment is performed based on the form of stateful load (StatefulSet). The container name (pod name) of a container (pod) is bound to a unique identifier to perform service deployment of the corresponding container based on the unique identifier. However, this form of service deployment is generally only applicable to service deployment scenarios with storage status, and needs to rely on stable local storage. Its service deployment process is relatively complex, and the efficiency of service upgrades and expansion and contraction is relatively low. If the shard service deployment is performed in the form of stateless load (Deployment). Each service needs to be transformed into a form without storage status, without a unique identifier, and does not rely on local memory. In this way, most services can be decoupled from data storage, improve service deployment efficiency, and reduce deployment complexity. However, this situation is inconsistent with the registration and discovery process of system services. When sharded services are deployed in the form of stateless load (Deployment), this service deployment form without unique identification and storage state characteristics will affect the service registration and discovery process of the container cluster management system and increase additional service deployment complexity. Based on this, a sharded service deployment method of an embodiment of the present application is provided to solve the technical problem that the unique identification of the service instance is difficult to be compatible with the service deployment in the existing sharded service deployment scenario based on the container cluster management system.

[0028] Example:

[0029] Figure 1 A flowchart of a sharding service deployment method provided in an embodiment of the present application is given. The sharding service deployment method provided in this embodiment can be executed by a sharding service deployment device, which can be implemented in software and / or hardware. The sharding service deployment device can be composed of two or more physical entities, or can be composed of one physical entity. Generally speaking, the sharding service deployment device can be a computing device such as a server host or a service platform.

[0030] The following description is made by taking the shard service deployment device as an example of the subject for executing the shard service deployment method. Figure 1 , the shard service deployment method specifically includes:

[0031] S110. When the target service instance is started, obtain a target unique identifier from a pre-built identifier directory.

[0032] When deploying a service instance, the embodiment of the present application configures a unique identifier for the target service instance so that the container cluster management system (Kubernetes) can be compatible with the unique identifier when deploying the service instance based on a stateless load (Deployment). This allows the system to efficiently deploy services and scale capacity without storage. It can also perform service registration and discovery, while ensuring the efficiency of service deployment and reducing the complexity of service deployment. Among them, the container cluster management system (Kubernetes) is referred to as k8s, which is an open source container cluster management system. Its main functions include container-based application deployment, maintenance and rolling upgrades, load balancing and service discovery.

[0033] It is understandable that when deploying service instances, a unique identifier (shard number) is required for each service instance to register its own service with the configuration center, for the caller to discover downstream service instances, and for making routing decisions. However, the service instances managed by the service deployment (Deployment) load in the container cluster management system (kubernetes) are mirrored and are not bound to the corresponding unique identifier (shard number). Their configurations are exactly the same and share the same configuration data format (yaml), so there is no corresponding state distinction. In order to realize the registration and discovery of service instances, it is necessary to configure the corresponding unique identifier for the service instance managed by the stateless load form (Deployment).

[0034] Based on this, when a service instance is started in the container cluster management system (Kubernetes), an embodiment of the present application will configure a unique identifier for the service instance to perform service registration, discovery and related call operations of the service instance based on the unique identifier. Among them, the service instance currently started by the container cluster management system (Kubernetes) is defined as the target service instance. When the target service instance is started, the application process of the unique identifier (shard number) will be executed. Afterwards, when the target service instance is destroyed, the unique identifier needs to be deleted to avoid the system from mistakenly calling the destroyed service based on the unique identifier.

[0035] Specifically, when the target service instance is started, a startup script start.py is executed according to the system image configuration, and the pre-built identification directory / k8s / sngen / {service_name} / available of the distributed database (zookeeper) is accessed based on the startup script start.py, and a unique identifier is selected from it, and the unique identifier is defined as the target unique identifier as the unique identifier of the current target service instance. Among them, the distributed database (zookeeper) is a sequentially consistent Key-Value (key value) storage distributed database, and is an open source distributed coordination service of Apache (Web server software), which can be used as service registration and service discovery in the backend service. After the identification directory is pre-built based on the distributed database (zookeeper), when the target service instance is started later, the pre-built identification directory / k8s / sngen / {service_name} / available of the distributed database (zookeeper) can be traversed through the startup script start.py, and the corresponding unique identifier is determined as the target unique identifier.

[0036] Prior to this, the shard service deployment device pre-builds multiple unique identifiers corresponding to the identification information range in the identification directory in the distributed database (zookeeper) according to the pre-configured identification information range. Among them, the identification information range indicates the value of all currently configurable unique identifiers. The shard service deployment device will create a new node nodes in the identification directory / k8s / sngen / {service_name} / available pre-built in the distributed database (zookeeper) according to the services to be migrated and the configurable identification information range in the cluster management system (kubernetes), indicating an available unique identifier. The node nodes is represented as: / k8s / sngen / {service_name} / available / {shard_number}.

[0037] Afterwards, when the cluster management system (Kubernetes) starts the target service instance, it can traverse the identification directory and randomly select a unique identifier from multiple unique identifiers in the identification directory as the target unique identifier. The target service instance starts the script start.py, and based on the startup script start.py, it traverses the pre-built identification directory / k8s / sngen / {service_name} / available, and randomly selects an available unique identifier (shard number) from it to determine the target unique identifier of the target service instance.

[0038] Optionally, in one embodiment, the target unique identifier can also be selected according to the order of arrangement of each unique identifier (shard number) in the identifier directory / k8s / sngen / {service_name} / available, and the unique identifier is selected in order as the target unique identifier. The embodiment of the present application does not impose a fixed restriction on the selection method of the target unique identifier, and will not be elaborated here.

[0039] S120: Create an instance name of the target service instance in the service instance directory, bind the target unique identifier to the target service instance to establish a binding relationship, and perform a service registration operation on the target service instance.

[0040] Furthermore, based on the determined target unique identifier, the embodiment of the present application further creates an instance name in the service instance directory of the cluster management system (Kubernetes), and binds the instance name to the target unique identifier to establish a binding relationship. And perform the service registration operation of the target service instance, and inject the target unique identifier into the registration center by performing the service registration operation on the target unique identifier. In this way, when the subsequent system needs to call the relevant service in the service instance directory, it can query the binding relationship through the instance name, determine the corresponding target unique identifier, and then determine each service instance that needs to be called in the registration center according to the target unique identifier.

[0041] Among them, by adding an instance name pod_name child node in the service instance directory / k8s / sngen / {service_name} / pods of the container cluster management system (kubernetes), setting the value of the child node to the target unique identifier, a binding relationship between the target unique identifier and the instance name is established. After the binding relationship is created, by executing the service registration operation of the target service instance, the service instance can be called based on the target unique identifier bound to the instance name during the subsequent service operation, thereby realizing service registration and discovery.

[0042] When performing service registration of the target service instance, the operating state of the target service instance is checked, and when the target service instance is in a predefined state, the service registration operation of the target service instance is performed based on the target unique identifier. Among them, the predefined state is the state in which the target service instance is in normal operation. It can be understood that in order to perform the service registration operation of the target service instance, the target service instance needs to be running healthily. Based on this, the embodiment of the present application triggers the service registration operation of the target service instance by detecting whether the target service instance is in a predefined state.

[0043] Specifically, refer to Figure 2 , the service registration process of the target service instance includes:

[0044] S1201, detecting the running status of the target service instance based on the status detection script;

[0045] S1202: When the target service instance is in a predefined state, write the target unique identifier, the IP address and port information of the target service instance into the service registration center to perform a registration operation of the target service instance.

[0046] In the container cluster management system (Kubernetes), a health detection probe is configured for each deployed service instance. The health detection probe is the status detection script. The status detection script periodically checks the survival of the target service instance and obtains its running status. When the running status of the target service instance is a predefined status, the service registration operation of the target service instance is triggered.

[0047] Among them, the status detection script calls the rpc (Remote Procedure Call Protocol) interface of the target service instance, and determines whether the running status of the target service instance is normal based on the interface. If the running status of the target service instance is a predefined state, the health check of the target service instance is successful. At this time, the distributed service deployment device will read the local file of the target service instance, obtain the target unique identifier (i.e., shard_number) stored therein, and register the service based on the target unique identifier. Write the target unique identifier to the service registration center. And write the IP address and port information of the target service instance and the storage node information where the target service instance is located to the service registration center to complete the registration operation of the target service instance. According to actual needs, other relevant information of the target service instance can also be written to the service registration center when registering the service instance. The embodiment of the present application does not impose fixed restrictions on the specific relevant information written, and will not be repeated here.

[0048] In addition, based on the instance name and binding relationship constructed in the service instance directory, when the upstream and downstream routing services need to call the target service instance later, they can query the binding relationship based on the instance name of the target service instance to determine the target unique identifier, and query the registration center based on the target unique identifier to determine the IP information and port information of the target service instance, and call the target service instance to achieve service discovery of the target service instance.

[0049] In addition, since the target unique identifier has been used, it is necessary to delete the unique identifier corresponding to the target unique identifier in the identification directory in the distributed database (zookeeper). It is understandable that since the target unique identifier has been used, if it is retained in the identification directory at this time, it will cause the target unique identifier to be bound to other service instances, resulting in confusion in service calls. Based on this, the embodiment of the present application finds the node node / k8s / sngen / {service_name} / available / {shard_number} corresponding to the target unique identifier in the identification directory / k8s / sngen / {service_name} / available pre-built in the distributed database (zookeeper), and deletes the node node. In this way, the unique identifier that has been used in the identification directory is deleted to ensure accurate calling of the service instance.

[0050] The embodiment of the present application configures a unique identifier for a service instance deployed by a container cluster management system (Kubernetes), thereby realizing service registration and discovery of the service instance, reducing the complexity of service deployment and improving service deployment efficiency.

[0051] In addition, in actual applications, when the upstream and downstream routing services call the target service instance, the instance name can also be resolved based on the system domain name analysis function to call the instance interface of the target service instance according to the instance name. It can be understood that the instance name of the target service instance contains the domain name information of the service instance. Based on the domain name analysis function of the container cluster management system (kubernetes), the domain name information of the corresponding service instance can be resolved from the instance name to implement the call to the service instance. Therefore, when making a service instance call, you can directly query the service instance directory / k8s / sngen / {service_name} / pods and implement the instance interface call of the service instance according to the instance name of the corresponding service instance.

[0052] S130. When a deletion event of the target service instance is monitored, the binding relationship is deleted in the service instance directory, and the target unique identifier is recorded back in the identification directory; and / or, the service instance directory is periodically traversed to determine whether the target service instance exists in the system cluster based on the instance name; when it is determined that the target service instance does not exist in the system cluster, the binding relationship is deleted in the service instance directory, and the target unique identifier is recorded back in the identification directory.

[0053] Furthermore, based on the deployed target service instance, in order to avoid wasting unique identifier configuration resources, the embodiment of the present application also performs a unique identifier recovery operation through the deregistered target service instance to achieve the reuse of the unique identifier, further reducing the complexity of service instance deployment, reducing the unique identifier creation process, simplifying the unique identifier generation process, and improving service instance deployment efficiency.

[0054] During the operation of the target service instance, the control module zk-controller of the distributed database (zookeeper) will monitor various events of the target service instance based on the list&watch mechanism of the container cluster management system (kubernetes). When the deletion event (pod delete) of the target service instance is monitored, the recovery process of the target unique identifier is triggered.

[0055] Specifically, the control loop of the control module zk-controller of the distributed database (zookeeper) will continue to monitor whether there is a deletion event (pod delete) of the target service instance. Once the deletion event (pod delete) is monitored, it means that the current target service instance is deregistered. At this time, the service instance deployment device connects to the distributed database (zookeeper), queries the service instance directory, and obtains the target unique identifier shardnumber through the storage path of the instance name / k8s / sngen / {service_name} / pods / {pod_name}. Based on the obtained target unique identifier, a node node / k8s / sngen / {service_name} / available / {shard_number} is recreated in the identification directory / k8s / sngen / {service_name} / available of the distributed database (zookeeper), indicating the target unique identifier, that is, the target unique identifier is recycled to the identification directory. Similarly, since the target unique identifier has been recycled at this time, the binding relationship established by the target service instance in the service instance directory needs to be deregistered. This is to avoid the upstream and downstream service routing from mistakenly calling the deregistered service instance according to the target unique identifier in the binding relationship. Among them, by deleting the node node / k8s / sngen / {service_name} / pods / {pod_name} in the service instance directory, the binding relationship cancellation operation of the target service instance is completed, and the recovery operation of the target unique identifier is realized.

[0056] In addition, the embodiment of the present application also provides another unique identifier recovery process as a compensation mechanism for the above-mentioned target unique identifier recovery process. This is to avoid the situation where the target service instance is deregistered but the unique identifier cannot be recovered when the deletion event is not detected. The two recovery processes that may not identify the target can be applied at the same time, or one can be applied selectively. The present application does not impose fixed restrictions on the recovery mechanism of the target unique identifier, and will not be elaborated on here.

[0057] The target unique identifier recovery process includes:

[0058] S1301, periodically traverse the service instance directory, and determine the instance name corresponding to the target service instance based on the binding relationship;

[0059] S1302: Call a node proxy interface based on the instance name, and query whether the target service instance exists in the system cluster through the node proxy interface.

[0060] Specifically, if it is determined that the target service instance is not in the system cluster of the current container cluster management system, it means that the target service instance is deregistered. Exemplarily, when the target unique identifier is recovered, the control module zk-controller of the distributed database (zookeeper) will periodically poll the service instance directory, call the kube-apiserver interface, and confirm whether the target service instance exists in the system cluster through the interface. Among them, the kube-apiserver interface is the data interface for the API server of the container cluster management system to verify and configure API objects. The API server provides services for REST operations and provides a front end for the shared state of the cluster. All other components interact through this front end.

[0061] Among them, the control module zk-controller of the distributed database (zookeeper) will query the system's / k8s / sngen subdirectory to obtain the service instance directory. Then, by traversing the service instance directory, all instance names under the service instance directory are obtained. By querying whether the service instance corresponding to each instance name exists in the system cluster, the service instance that is not in the system cluster can be determined. Finally, the service instance that is not in the system cluster will be deleted from the service instance directory, and the target unique identifier bound to it will be recorded back in the identifier directory to achieve the recovery of the unique identifier.

[0062] By providing a compensation mechanism for the unique identifier recycling process, the unique identifier can be recycled to the identifier directory as much as possible. This reduces the unique identifier creation process and enables the unique identifier to be reused. This improves the deployment efficiency of service instances and optimizes the operation of system services.

[0063] In the above, when the target service instance is started, the target unique identifier is obtained from the pre-built identification directory; then the instance name of the target service instance is created in the service instance directory, the target unique identifier is bound to the target service instance to build a binding relationship, and the service registration operation of the target service instance is performed; afterwards, when the deletion event of the target service instance is monitored, the binding relationship is deleted in the service instance directory, and the target unique identifier is recorded back to the identification directory; and / or, the service instance directory is periodically traversed to determine whether the target service instance exists in the system cluster according to the instance name; when it is determined that the target service instance does not exist in the system cluster, the binding relationship is deleted in the service instance directory, and the target unique identifier is recorded back to the identification directory. By adopting the above technical means, when deploying the shard service based on the container cluster management system, the unique identifier of the target service instance can be configured, and the service registration and discovery operations of the target service instance can be performed, while ensuring the efficiency of service deployment, reducing the complexity of system shard service deployment. In addition, the embodiment of the present application can realize the reuse of the unique identifier by recycling the unique identifier when the service is deregistered, further reducing the complexity of service deployment.

[0064] Based on the above embodiments, Figure 4 A schematic diagram of the structure of a sharding service deployment system provided for this application. Figure 4 The sharding service deployment system provided in this embodiment specifically includes: an acquisition module 21, a creation module 22 and a recovery module 23.

[0065] Wherein, the acquisition module is configured to obtain the target unique identifier from the pre-built identifier directory when the target service instance is started;

[0066] A creation module is configured to create an instance name of a target service instance in a service instance directory, bind a target unique identifier to the target service instance to establish a binding relationship, and perform a service registration operation on the target service instance;

[0067] The recycling module is configured to delete the binding relationship in the service instance directory and record the target unique identifier back to the identification directory when monitoring the deletion event of the target service instance; and / or periodically traverse the service instance directory to determine whether the target service instance exists in the system cluster based on the instance name; if it is determined that the target service instance does not exist in the system cluster, delete the binding relationship in the service instance directory and record the target unique identifier back to the identification directory.

[0068] Specifically, the acquisition module 21 is configured to construct multiple unique identifiers corresponding to the identification information range in the identification directory according to the preconfigured identification information range; traverse the identification directory, and randomly select a unique identifier from the multiple unique identifiers in the identification directory as the target unique identifier.

[0069] Specifically, the creation module 22 is also configured to check the running status of the target service instance, and when the target service instance is in a predefined state, perform the service registration operation of the target service instance based on the target unique identifier. Among them, the running status of the target service instance is detected based on the status detection script; when the target service instance is in a predefined state, the target unique identifier, the IP address and port information of the target service instance are written to the service registration center to perform the registration operation of the target service instance. In addition, the unique identifier corresponding to the target unique identifier in the identifier directory is deleted. The instance name is resolved based on the system domain name analysis function to call the instance interface of the target service instance according to the instance name.

[0070] The recycling module 23 is also configured to periodically traverse the service instance directory, determine the instance name corresponding to the target service instance based on the binding relationship, call the node agent interface of the target service instance based on the instance name, and query whether the target service instance exists in the system cluster through the node agent interface.

[0071] In the above, when the target service instance is started, the target unique identifier is obtained from the pre-built identification directory; then the instance name of the target service instance is created in the service instance directory, the target unique identifier is bound to the target service instance to build a binding relationship, and the service registration operation of the target service instance is performed; thereafter, when the deletion event of the target service instance is monitored, the binding relationship is deleted in the service instance directory, and the target unique identifier is recorded back to the identification directory; and / or, the service instance directory is periodically traversed to determine whether the target service instance exists in the system cluster according to the instance name; when it is determined that the target service instance does not exist in the system cluster, the binding relationship is deleted in the service instance directory, and the target unique identifier is recorded back to the identification directory. By adopting the above technical means, when deploying a shard service based on a container cluster management system, the unique identifier of the target service instance can be configured, and the service registration and discovery operations of the target service instance can be performed, while ensuring the efficiency of service deployment, reducing the complexity of system shard service deployment. In addition, the embodiment of the present application can realize the reuse of the unique identifier by recycling the unique identifier when the service is deregistered, further reducing the complexity of service deployment.

[0072] The sharding service deployment system provided in the embodiment of the present application can be configured to execute the sharding service deployment method provided in the above embodiment, and has corresponding functions and beneficial effects.

[0073] Based on the above practical example, the present application embodiment also provides a sharding service deployment device, referring to Figure 5, the slicing service deployment device includes: a processor 31, a memory 32, a communication module 33, an input device 34 and an output device 35. The memory 32, as a computer-readable storage medium, can be configured to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the slicing service deployment method described in any embodiment of the present application (for example, the acquisition module, creation module and recycling module in the slicing service deployment system). The communication module 33 is configured to perform data transmission. The processor executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory, that is, realizing the above-mentioned slicing service deployment method. The input device 34 can be configured to receive input digital or character information, and generate key signal input related to the user settings and function control of the device. The output device 35 may include a display device such as a display screen. The above-mentioned slicing service deployment device can be configured to execute the slicing service deployment method provided in the above-mentioned embodiment, and has corresponding functions and beneficial effects.

[0074] On the basis of the above embodiments, the embodiments of the present application further provide a storage medium containing computer executable instructions, wherein the computer executable instructions are configured to execute a sharding service deployment method when executed by a computer processor, and the storage medium may be any of various types of memory devices or storage devices. Of course, the storage medium containing computer executable instructions provided in the embodiments of the present application, whose computer executable instructions are not limited to the sharding service deployment method described above, can also execute the related operations in the sharding service deployment method provided in any embodiment of the present application.

[0075] On the basis of the above embodiments, the embodiments of the present application also provide a computer program product. The technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer program product is stored in a storage medium, including a number of instructions for enabling a computer device, a mobile terminal or a processor therein to execute all or part of the steps of the sharding service deployment method described in each embodiment of the present application.

Claims

1. A sharding service deployment method, characterized in that: include: When the target service instance is started, the target unique identifier is obtained from the pre-built identifier directory; Creating an instance name of the target service instance in the service instance directory of the container cluster management system, setting the key value of the instance name to the target unique identifier, so as to bind the target unique identifier to the instance name of the target service instance to establish a binding relationship, and performing a service registration operation of the target service instance; When a deletion event of the target service instance is monitored, the binding relationship is deleted in the service instance directory, and the target unique identifier is recorded back in the identifier directory; and / or, Periodically traverse the service instance directory, and determine whether the target service instance exists in the system cluster according to the instance name; In the case where it is determined that the target service instance does not exist in the system cluster, deleting the binding relationship in the service instance directory, and recording the target unique identifier back into the identifier directory; The step of recording the target unique identifier back into the identifier directory includes: The service instance directory is queried, the target unique identifier is obtained based on the storage path of the instance name of the target service instance, and a node is created in the identifier directory based on the target unique identifier to represent the target unique identifier.

2. The sharding service deployment method according to claim 1, characterized in that: Before obtaining the target unique identifier from the pre-built identifier directory, it also includes: According to the preconfigured identification information range, constructing a plurality of unique identifications corresponding to the identification information range in the identification directory; The step of obtaining the target unique identifier from the pre-built identifier directory includes: The identification directory is traversed, and a unique identifier is randomly selected from multiple unique identifiers in the identification directory as the target unique identifier.

3. The sharding service deployment method according to claim 2, characterized in that: After obtaining the target unique identifier from the pre-built identifier directory, the following step further includes: Delete the unique identifier corresponding to the target unique identifier in the identifier directory.

4. The sharding service deployment method according to claim 1, characterized in that: The performing of the service registration operation of the target service instance includes: The running state of the target service instance is checked, and when the target service instance is in a predefined state, a service registration operation of the target service instance is performed based on the target unique identifier.

5. The sharding service deployment method according to claim 4, characterized in that: The checking the running state of the target service instance and performing a service registration operation of the target service instance based on the target unique identifier when the target service instance is in a predefined state includes: Detecting the running status of the target service instance based on a status detection script; When the target service instance is in a predefined state, the target unique identifier, the IP address and port information of the target service instance are written into a service registration center to perform a registration operation of the target service instance.

6. The sharding service deployment method according to claim 1, characterized in that: After binding the target unique identifier with the instance name of the target service instance to establish a binding relationship, the method further includes: The instance name is parsed based on a system domain name analysis function to call the instance interface of the target service instance according to the instance name.

7. The sharding service deployment method according to claim 1, characterized in that: The periodically traversing the service instance directory and determining whether the target service instance exists in the system cluster according to the instance name includes: Periodically traverse the service instance directory, and determine the instance name corresponding to the target service instance based on the binding relationship; A node agent interface is called based on the instance name, and whether the target service instance exists in the system cluster is queried through the node agent interface.

8. A sharding service deployment system, characterized in that: include: An acquisition module is configured to obtain a target unique identifier from a pre-built identifier directory when a target service instance is started; A creation module is configured to create an instance name of the target service instance in the service instance directory of the container cluster management system, set the key value of the instance name to the target unique identifier, and bind the target unique identifier to the instance name of the target service instance to establish a binding relationship , And execute the service registration operation of the target service instance; The recycling module is configured to delete the binding relationship in the service instance directory and record the target unique identifier back to the identifier directory when monitoring the deletion event of the target service instance; and / or periodically traverse the service instance directory to determine whether the target service instance exists in the system cluster according to the instance name; In the case where it is determined that the target service instance does not exist in the system cluster, deleting the binding relationship in the service instance directory, and recording the target unique identifier back into the identifier directory; The step of recording the target unique identifier back into the identifier directory includes: The service instance directory is queried, the target unique identifier is obtained based on the storage path of the instance name of the target service instance, and a node is created in the identifier directory based on the target unique identifier to represent the target unique identifier.

9. A sharding service deployment device, characterized in that: include: memory and one or more processors; The memory is configured to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the sharding service deployment method as described in any one of claims 1-7.

10. A storage medium containing computer executable instructions, characterized in that: When the computer executable instructions are executed by a computer processor, they are configured to execute the sharding service deployment method as described in any one of claims 1-7.

11. A computer program product, characterized in that The computer program product includes instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes the sharding service deployment method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Method and system for distributed deployment, unified configuration and automatic adaptation

    CN105100200A

  • Living example service management method, device and system

    CN106844793A